Skip to content

Commit

Permalink
Merge pull request #455 from hosiet/pr-fix-python3.12-syntaxwarning-i…
Browse files Browse the repository at this point in the history
…nvalid-escape-seq

Mark regex/docstring as raw to fix SyntaxWarning invalid escape seq
  • Loading branch information
typemytype authored Apr 11, 2024
2 parents 104f9c2 + 71fc2f9 commit 4b7a05f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Lib/defcon/objects/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def redo(self):
# ---------------

def getRepresentation(self, name, **kwargs):
"""
r"""
Get a representation. **name** must be a registered
representation name. **\*\*kwargs** will be passed
to the appropriate representation factory.
Expand All @@ -357,7 +357,7 @@ def getRepresentation(self, name, **kwargs):
return representations[subKey]

def destroyRepresentation(self, name, **kwargs):
"""
r"""
Destroy the stored representation for **name**
and **\*\*kwargs**. If no **kwargs** are given,
any representation with **name** will be destroyed
Expand Down Expand Up @@ -402,7 +402,7 @@ def representationKeys(self):
return representations

def hasCachedRepresentation(self, name, **kwargs):
"""
r"""
Returns a boolean indicating if a representation for
**name** and **\*\*kwargs** is cached in the object.
"""
Expand Down
16 changes: 8 additions & 8 deletions Lib/defcon/objects/font.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

class Font(BaseObject):

"""
r"""
If loading from an existing UFO, **path** should be the path to the UFO.
If you subclass one of the sub objects, such as :class:`Glyph`,
Expand Down Expand Up @@ -1647,13 +1647,13 @@ def _convertFromFormatVersion1RoboFabData(self):
setattr(self.info, infoAttr, value)

featureRE = re.compile(
"^" # start of line
"\s*" #
"feature" # feature
"\s+" #
"(\w{4})" # four alphanumeric characters
"\s*" #
"\{" # {
r"^" # start of line
r"\s*" #
r"feature" # feature
r"\s+" #
r"(\w{4})" # four alphanumeric characters
r"\s*" #
r"\{" # {
, re.MULTILINE # run in multiline to preserve line seps
)

Expand Down
2 changes: 1 addition & 1 deletion Lib/defcon/test/objects/test_kerning.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_get(self):
def test___getitem__(self):
font = Font(getTestFontPath())
self.assertEqual(font.kerning["A", "A"], -100)
with self.assertRaisesRegex(KeyError, "\('NotInFont', 'NotInFont'\)"):
with self.assertRaisesRegex(KeyError, r"\('NotInFont', 'NotInFont'\)"):
font.kerning["NotInFont", "NotInFont"]

def test___setitem__(self):
Expand Down

0 comments on commit 4b7a05f

Please sign in to comment.