Skip to content

Commit

Permalink
Prevent singleton instance from name shadowing its class (#1378)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitchoi committed Jan 4, 2021
1 parent 6e924d2 commit a68bc50
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions traits/trait_type.py
Expand Up @@ -73,7 +73,7 @@ class NoDefaultSpecified(object):
pass


NoDefaultSpecified = NoDefaultSpecified()
no_default_specified = NoDefaultSpecified()


class TraitType(BaseTraitHandler):
Expand Down Expand Up @@ -173,7 +173,7 @@ class TraitType(BaseTraitHandler):
#: The metadata for the trait.
metadata = {}

def __init__(self, default_value=NoDefaultSpecified, **metadata):
def __init__(self, default_value=no_default_specified, **metadata):
""" TraitType initializer
This is the only method normally called directly by client code.
Expand All @@ -183,7 +183,7 @@ def __init__(self, default_value=NoDefaultSpecified, **metadata):
Override this method whenever a different method signature or a
validated default value is needed.
"""
if default_value is not NoDefaultSpecified:
if default_value is not no_default_specified:
self.default_value = default_value

if len(metadata) > 0:
Expand Down Expand Up @@ -257,7 +257,7 @@ def get_default_value(self):

return (dvt, dv)

def clone(self, default_value=NoDefaultSpecified, **metadata):
def clone(self, default_value=no_default_specified, **metadata):
""" Copy, optionally modifying default value and metadata.
Clones the contents of this object into a new instance of the same
Expand Down Expand Up @@ -294,7 +294,7 @@ def clone(self, default_value=NoDefaultSpecified, **metadata):

new._metadata.update(metadata)

if default_value is not NoDefaultSpecified:
if default_value is not no_default_specified:
new.default_value = default_value
if self.validate is not None:
try:
Expand Down

0 comments on commit a68bc50

Please sign in to comment.