Skip to content

Commit

Permalink
Merge pull request #417 from madig/minor-lint-fixes
Browse files Browse the repository at this point in the history
Minor lint fixes
  • Loading branch information
madig authored Sep 9, 2018
2 parents d2ee7ef + 758a160 commit 44af0f8
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 21 deletions.
6 changes: 3 additions & 3 deletions Lib/glyphsLib/affine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,10 @@ def __str__(self):

def __repr__(self):
"""Precise string representation."""
return ("Affine(%r, %r, %r,\n" " %r, %r, %r)") % self[:6]
return "Affine(%r, %r, %r,\n" " %r, %r, %r)" % self[:6]

def to_gdal(self):
return (self.c, self.a, self.b, self.f, self.d, self.e)
return self.c, self.a, self.b, self.f, self.d, self.e

@property
def xoff(self):
Expand Down Expand Up @@ -387,7 +387,7 @@ def __mul__(self, other):
vx, vy = other
except Exception:
return NotImplemented
return (vx * sa + vy * sd + sc, vx * sb + vy * se + sf)
return vx * sa + vy * sd + sc, vx * sb + vy * se + sf

def __rmul__(self, other):
# We should not be called if other is an affine instance
Expand Down
2 changes: 1 addition & 1 deletion Lib/glyphsLib/builder/custom_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ def to_ufo(self, glyphs, ufo):
# See https://github.com/googlei18n/glyphsLib/issues/214
class FilterParamHandler(AbstractParamHandler):
def glyphs_names(self):
return ("Filter", "PreFilter")
return "Filter", "PreFilter"

def ufo_names(self):
return (UFO2FT_FILTERS_KEY,)
Expand Down
9 changes: 4 additions & 5 deletions Lib/glyphsLib/builder/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def _previous_char(self, line, char):
while char == 0:
line -= 1
char = len(self._lines[line - 1])
return (line, char)
return line, char

def _in_block_end_location(self, block):
_, line, char = block.end_location
Expand All @@ -353,7 +353,7 @@ def current_char(line, char):
# Skip it and we're done
line, char = self._previous_char(line, char)

return (None, line, char)
return None, line, char


class PeekableIterator(object):
Expand Down Expand Up @@ -391,7 +391,6 @@ def __init__(self, doc, glyphs_module):

def to_glyphs(self, font):
self._font = font
self._font
self._process_file()

PREFIX_RE = re.compile("^# Prefix: (.*)$")
Expand Down Expand Up @@ -565,7 +564,7 @@ def _pop_comment(self, statements, comment_re):
match = comment_re.match(st.text)
if not match:
res.append(st)
return (match, res)
return match, res

def _pop_comment_block(self, statements, header_re):
"""Look for a series of comments that start with one that matches the
Expand Down Expand Up @@ -598,7 +597,7 @@ def _pop_comment_block(self, statements, header_re):
# Keep the rest of the statements
res.extend(list(st_iter))
# Inside the comment block, drop the pound sign and any common indent
return (match, dedent("".join(c.text[1:] + "\n" for c in comments)), res)
return match, dedent("".join(c.text[1:] + "\n" for c in comments)), res

# Strip up to the given number of newlines from the right end of the string
def _rstrip_newlines(self, string, number=1):
Expand Down
17 changes: 8 additions & 9 deletions Lib/glyphsLib/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def __repr__(self):
"""Return list-lookalike of representation string of objects"""
strings = []
for currItem in self:
strings.append("%s" % (currItem))
strings.append("%s" % currItem)
return "(%s)" % (", ".join(strings))

def __len__(self):
Expand All @@ -400,7 +400,7 @@ def pop(self, i):
del self[i]
return node
else:
raise (KeyError)
raise KeyError

def __iter__(self):
values = self.values()
Expand Down Expand Up @@ -502,7 +502,7 @@ def __getitem__(self, Key):
if master.id == Key:
return master
else:
raise (KeyError)
raise KeyError

def __setitem__(self, Key, FontMaster):
FontMaster.font = self._owner
Expand All @@ -518,7 +518,7 @@ def __setitem__(self, Key, FontMaster):
Index = self._owner._masters.index(OldFontMaster)
self._owner._masters[Index] = FontMaster
else:
raise (KeyError)
raise KeyError

def __delitem__(self, Key):
if type(Key) is int:
Expand Down Expand Up @@ -1224,7 +1224,7 @@ class GSCustomParameter(GSBase):
"openTypeHeadFlags",
)
)
_CUSTOM_DICT_PARAMS = frozenset(("GASP Table"))
_CUSTOM_DICT_PARAMS = frozenset("GASP Table")

def __init__(self, name="New Value", value="New Parameter"):
self.name = name
Expand Down Expand Up @@ -1494,7 +1494,7 @@ def _splitName(self, value):
previous_was_removed = False
names.append(name)
custom = " ".join(names).strip()
return (weight, width, custom)
return weight, width, custom

customParameters = property(
lambda self: CustomParametersProxy(self),
Expand Down Expand Up @@ -1727,7 +1727,6 @@ def segments(self):
self._segmentLength += 1
segmentCount += 1

self._segments
return self._segments

@segments.setter
Expand Down Expand Up @@ -2007,7 +2006,7 @@ def scale(self):
self._sX, self._sY, self._R = transformStructToScaleAndRotation(
self.transform.value
)
return (self._sX, self._sY)
return self._sX, self._sY

@scale.setter
def scale(self, value):
Expand Down Expand Up @@ -2620,7 +2619,7 @@ def position(self, value):
# .scale
@property
def scale(self):
return (self._sX, self._sY)
return self._sX, self._sY

@scale.setter
def scale(self, value):
Expand Down
4 changes: 2 additions & 2 deletions Lib/glyphsLib/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def main(args=None):
parser_glyphs2ufo = subparsers.add_parser("glyphs2ufo", help=glyphs2ufo.__doc__)
parser_glyphs2ufo.set_defaults(func=glyphs2ufo)
parser_glyphs2ufo.add_argument(
"--version", action="version", version="glyphsLib %s" % (glyphsLib.__version__)
"--version", action="version", version="glyphsLib %s" % glyphsLib.__version__
)
parser_glyphs2ufo.add_argument(
"glyphs_file", metavar="GLYPHS_FILE", help="Glyphs file to convert."
Expand Down Expand Up @@ -102,7 +102,7 @@ def main(args=None):
parser_ufo2glyphs = subparsers.add_parser("ufo2glyphs", help=ufo2glyphs.__doc__)
parser_ufo2glyphs.set_defaults(func=ufo2glyphs)
parser_ufo2glyphs.add_argument(
"--version", action="version", version="glyphsLib %s" % (glyphsLib.__version__)
"--version", action="version", version="glyphsLib %s" % glyphsLib.__version__
)
parser_ufo2glyphs.add_argument(
"designspace_file_or_UFOs",
Expand Down
2 changes: 1 addition & 1 deletion Lib/glyphsLib/glyphdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def _construct_category(glyph_name, unicode_category):
# Exception: Something like "one_two" should be a (_, Ligature),
# "acutecomb_brevecomb" should however stay (Mark, Nonspacing).
if "_" in glyph_name and glyphs_category[0] != "Mark":
return (glyphs_category[0], "Ligature")
return glyphs_category[0], "Ligature"

return glyphs_category

Expand Down

0 comments on commit 44af0f8

Please sign in to comment.