Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLN: Remove Class trait #520

Merged
merged 5 commits into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions docs/source/traits_api_reference/trait_types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ Traits

.. autoclass:: Method

.. autoclass:: Class

.. autoclass:: Module

.. autoclass:: Python
Expand Down Expand Up @@ -202,10 +200,6 @@ Traits

.. autodata:: ListMethod

.. autodata:: ListClass

.. autodata:: ListInstance

.. autodata:: ListThis

.. autodata:: DictStrAny
Expand Down
8 changes: 2 additions & 6 deletions docs/source/traits_user_manual/defining.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,15 @@ casting traits::
Other Predefined Traits
```````````````````````
The Traits package provides a number of other predefined traits besides those
for simple types, corresponding to other commonly used data types; these
for simple types, corresponding to other commonly used data types; ::these
predefined traits are listed in the following table. Refer to the
*Traits API Reference*, in the section for the module traits.traits,
for details. Most can be used either as simple names, which use their built-in
default values, or as callables, which can take additional arguments. If the
trait cannot be used as a simple name, it is omitted from the Name column of
the table.

.. index:: Any(), Array(), Button(), Callable(), CArray(), Class(), Code()
.. index:: Any(), Array(), Button(), Callable(), CArray(), Code()
.. index:: Color(), CSet(), Constant(), Dict()
.. index:: Directory(), Disallow, Either(), Enum()
.. index:: Event(), Expression(), false, File(), Font()
Expand Down Expand Up @@ -277,8 +277,6 @@ the table.
| CArray | CArray( [*dtype* = None, *shape* = None, *value* = None, |
| | *typecode* = None, \*\*\ *metadata*] ) |
+------------------+----------------------------------------------------------+
| Class | Class( [*value*, \*\*\ *metadata*] ) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the Class entry from the index above this table, too.

+------------------+----------------------------------------------------------+
| Code | Code( [*value* = '', *minlen* = 0, *maxlen* = sys.maxint,|
| | *regex* = '', \*\*\ *metadata*] ) |
+------------------+----------------------------------------------------------+
Expand Down Expand Up @@ -332,11 +330,9 @@ the table.
| | *module* = None, \*\*\ *metadata*] ) |
+------------------+----------------------------------------------------------+
| List, ListBool, | List([*trait* = None, *value* = None, *minlen* = 0, |
| ListClass, | *maxlen* = sys.maxint, *items* = True, \*\*\ *metadata*])|
| ListComplex, | |
| ListFloat, | |
| ListFunction, | |
| ListInstance, | |
| ListInt, | |
| ListMethod, | |
| ListStr, | |
Expand Down
8 changes: 0 additions & 8 deletions traits/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,6 @@
DictStrList,
)

try:
from .trait_types import Class, ListClass, ListInstance
except ImportError:
# Python 3 does not have old-style classes anymore, so Class does not exist
# interestingly, ListInstance is not equivalent to List(Instance), but
# rather only allows old-style instances.
pass

from .trait_types import (
BaseInt,
BaseLong,
Expand Down
23 changes: 0 additions & 23 deletions traits/trait_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1210,20 +1210,6 @@ class Method(TraitType):
info_text = "a method"


if six.PY2:
from types import ClassType

class Class(TraitType):
""" Defines a trait whose value must be an old-style Python class.
"""

#: The C-level fast validator to use:
fast_validate = (11, ClassType)

#: A description of the type of value this trait accepts:
info_text = "an old-style class"


class Module(TraitType):
""" Defines a trait whose value must be a Python module.
"""
Expand Down Expand Up @@ -3857,15 +3843,6 @@ def resolve_class(self, object, name, value):
#: List of method values; default value is [].
ListMethod = List(MethodType)

if six.PY2:
from types import ClassType, InstanceType

#: List of class values; default value is [].
ListClass = List(ClassType)

#: List of instance values; default value is [].
ListInstance = List(InstanceType)

#: List of container type values; default value is [].
ListThis = List(ThisClass)

Expand Down