Skip to content

Commit e8c0600

Browse files
[Python] NotImplemented → NotImplementedError
From the Python documentation: * NotImplemented: "Special value which can be returned by the 'rich comparison' special methods (__eq__(), __lt__(), and friends), to indicate that the comparison is not implemented with respect to the other type." * NotImplementedError: "This exception is derived from RuntimeError. In user defined base classes, abstract methods should raise this exception when they require derived classes to override the method."
1 parent bf83474 commit e8c0600

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

utils/GYBUnicodeDataUtils.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,24 @@ class UnicodeProperty(object):
1515
"""Abstract base class for Unicode properties."""
1616

1717
def __init__(self):
18-
raise NotImplemented
18+
raise NotImplementedError(
19+
"UnicodeProperty.__init__ is not implemented.")
1920

2021
def get_default_value(self):
21-
raise NotImplemented
22+
raise NotImplementedError(
23+
"UnicodeProperty.get_default_value is not implemented.")
2224

2325
def get_value(self, cp):
24-
raise NotImplemented
26+
raise NotImplementedError(
27+
"UnicodeProperty.get_value is not implemented.")
2528

2629
def to_numeric_value(self, value):
27-
raise NotImplemented
30+
raise NotImplementedError(
31+
"UnicodeProperty.to_numeric_value is not implemented.")
2832

2933
def get_numeric_value(self, cp):
30-
raise NotImplemented
34+
raise NotImplementedError(
35+
"UnicodeProperty.get_numeric_value is not implemented.")
3136

3237
class GraphemeClusterBreakPropertyTable(UnicodeProperty):
3338
"""Grapheme_Cluster_Break property."""

utils/gyb.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -561,13 +561,13 @@ class ASTNode(object):
561561
"""Abstract base class for template AST nodes"""
562562

563563
def __init__(self):
564-
raise NotImplemented
564+
raise NotImplementedError("ASTNode.__init__ is not implemented.")
565565

566566
def execute(self, context):
567-
raise NotImplemented
567+
raise NotImplementedError("ASTNode.execute is not implemented.")
568568

569569
def __str__(self, indent=''):
570-
raise NotImplemented
570+
raise NotImplementedError("ASTNode.__str__ is not implemented.")
571571

572572
def format_children(self, indent):
573573
if not self.children:

0 commit comments

Comments
 (0)