Skip to content
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
5 changes: 1 addition & 4 deletions apptools/persistence/state_pickler.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class StatePickler:
will return the dictionary that is pickled.

The format of the state dict is quite strightfoward. Basic types
(bool, int, long, float, complex, None, string and unicode) are
(bool, int, long, float, complex, None, string) are
represented as they are. Everything else is stored as a
dictionary containing metadata information on the object's type
etc. and also the actual object in the 'data' key. For example::
Expand Down Expand Up @@ -268,9 +268,6 @@ def __init__(self):
NumpyArrayType: self._do_numeric,
State: self._do_state,
}
if PY_VER == 2:
type_map[long] = self._do_basic_type
type_map[unicode] = self._do_basic_type
self.type_map = type_map

def dump(self, value, file):
Expand Down
4 changes: 2 additions & 2 deletions apptools/persistence/tests/test_state_pickler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import numpy

from traits.api import Bool, Int, Array, Float, Complex, Any, \
Str, Unicode, Instance, Tuple, List, Dict, HasTraits
Str, Instance, Tuple, List, Dict, HasTraits

try:
from tvtk.api import tvtk
Expand Down Expand Up @@ -69,7 +69,7 @@ class TestTraits(HasTraits):
c = Complex(complex(1.01234, 2.3))
n = Any
s = Str('String')
u = Unicode(u'Unicode')
u = Str(u'Unicode')
inst = Instance(A)
tuple = Tuple
list = List
Expand Down
6 changes: 3 additions & 3 deletions apptools/preferences/preference_binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Enthought library imports.
from traits.api import Any, HasTraits, Instance, Str, Undefined
from traits.api import Unicode
from traits.api import Str

# Third-party librart imports.
import six
Expand Down Expand Up @@ -102,8 +102,8 @@ def _get_value(self, trait_name, value):
if type(handler) is Str:
pass

# If the trait type is 'Unicode' then we convert the raw value.
elif type(handler) is Unicode:
# If the trait type is 'Str' then we convert the raw value.
elif type(handler) is Str:
value = six.text_type(value)

# Otherwise, we eval it!
Expand Down
6 changes: 3 additions & 3 deletions apptools/preferences/preferences_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import logging

# Enthought library imports.
from traits.api import HasTraits, Instance, Str, Unicode
from traits.api import HasTraits, Instance, Str

# Local imports.
from .i_preferences import IPreferences
Expand Down Expand Up @@ -128,8 +128,8 @@ def _get_value(self, trait_name, value):
trait = self.trait(trait_name)
handler = trait.handler

# If the trait type is 'Str' or Unicode then we just take the raw value.
if isinstance(handler, (Str, Unicode)) or trait.is_str:
# If the trait type is 'Str' then we just take the raw value.
if isinstance(handler, Str) or trait.is_str:
pass

# Otherwise, we eval it!
Expand Down
18 changes: 9 additions & 9 deletions apptools/preferences/tests/test_preferences_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from apptools.preferences.api import Preferences, PreferencesHelper
from apptools.preferences.api import ScopedPreferences
from apptools.preferences.api import set_default_preferences
from traits.api import Any, Bool, HasTraits, Int, Float, List, Str, Unicode
from traits.api import Any, Bool, HasTraits, Int, Float, List, Str


def width_listener(obj, trait_name, old, new):
Expand Down Expand Up @@ -86,7 +86,7 @@ class AcmeUIPreferencesHelper(PreferencesHelper):
width = Int
ratio = Float
visible = Bool
description = Unicode
description = Str
offsets = List(Int)
names = List(Str)

Expand Down Expand Up @@ -138,7 +138,7 @@ class AcmeUIPreferencesHelper(PreferencesHelper):
width = Int
ratio = Float
visible = Bool
description = Unicode
description = Str
offsets = List(Int)
names = List(Str)

Expand Down Expand Up @@ -192,7 +192,7 @@ class AcmeUIPreferencesHelper(PreferencesHelper):
width = Int(50)
ratio = Float(1.0)
visible = Bool(True)
description = Unicode(u'description')
description = Str(u'description')
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We could go further and drop the u prefixes, but that's probably best done in a separate PR.

offsets = List(Int, [1, 2, 3, 4])
names = List(Str, ['joe', 'fred', 'jane'])

Expand Down Expand Up @@ -224,7 +224,7 @@ class AcmeUIPreferencesHelper(PreferencesHelper):
width = Int(50)
ratio = Float(1.0)
visible = Bool(True)
description = Unicode(u'')
description = Str(u'')
offsets = List(Int, [1, 2, 3, 4])
names = List(Str, ['joe', 'fred', 'jane'])

Expand Down Expand Up @@ -269,7 +269,7 @@ class AcmeUIPreferencesHelper(PreferencesHelper):
width = Int
ratio = Float
visible = Bool
description = Unicode
description = Str
offsets = List(Int)
names = List(Str)

Expand Down Expand Up @@ -301,7 +301,7 @@ class AcmeUIPreferencesHelper(PreferencesHelper):
width = Int
ratio = Float
visible = Bool
description = Unicode
description = Str
offsets = List(Int)
names = List(Str)

Expand Down Expand Up @@ -414,7 +414,7 @@ class AcmeUIPreferencesHelper(PreferencesHelper):
width = Int
ratio = Float
visible = Bool
description = Unicode
description = Str
offsets = List(Int)
names = List(Str)

Expand Down Expand Up @@ -478,7 +478,7 @@ class AcmeUIPreferencesHelper(PreferencesHelper):
width = Int
ratio = Float
visible = Bool
description = Unicode
description = Str
offsets = List(Int)
names = List(Str)

Expand Down
4 changes: 2 additions & 2 deletions apptools/scripting/recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import six.moves.builtins

from traits.api import (HasTraits, List, Str, Dict, Bool,
Unicode, Property, Int, Instance)
Property, Int, Instance)
from traits.util.camel_case import camel_case_to_python


Expand Down Expand Up @@ -101,7 +101,7 @@ class Recorder(HasTraits):

# The Python script we have recorded so far. This is just a
# convenience trait for the `get_code()` method.
script = Property(Unicode)
script = Property(Str)

########################################
# Private traits.
Expand Down
4 changes: 2 additions & 2 deletions apptools/undo/abstract_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#------------------------------------------------------------------------------

# Enthought library imports.
from traits.api import Any, HasTraits, Unicode, provides
from traits.api import Any, HasTraits, Str, provides

# Local imports.
from .i_command import ICommand
Expand All @@ -33,7 +33,7 @@ class AbstractCommand(HasTraits):
# This is the name of the command as it will appear in any GUI element. It
# may include '&' which will be automatically removed whenever it is
# inappropriate.
name = Unicode
name = Str

###########################################################################
# 'ICommand' interface.
Expand Down
6 changes: 3 additions & 3 deletions apptools/undo/command_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Enthought library imports.
from traits.api import Bool, HasTraits, Instance, Int, List, Property, \
Unicode, provides
Str, provides

# Local imports.
from .abstract_command import AbstractCommand
Expand Down Expand Up @@ -99,15 +99,15 @@ class CommandStack(HasTraits):
# This is the name of the command that can be redone. It will be empty if
# there is no command that can be redone. It is maintained by the undo
# stack.
redo_name = Property(Unicode)
redo_name = Property(Str)

# This is the undo manager that manages this stack.
undo_manager = Instance(IUndoManager)

# This is the name of the command that can be undone. It will be empty if
# there is no command that can be undone. It is maintained by the undo
# stack.
undo_name = Property(Unicode)
undo_name = Property(Str)

#### Private interface ####################################################

Expand Down
4 changes: 2 additions & 2 deletions apptools/undo/i_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


# Enthought library imports.
from traits.api import Any, Interface, Unicode
from traits.api import Any, Interface, Str


class ICommand(Interface):
Expand All @@ -31,7 +31,7 @@ class ICommand(Interface):
# This is the name of the command as it will appear in any GUI element. It
# may include '&' which will be automatically removed whenever it is
# inappropriate.
name = Unicode
name = Str

###########################################################################
# 'ICommand' interface.
Expand Down
6 changes: 3 additions & 3 deletions apptools/undo/i_command_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#------------------------------------------------------------------------------

# Enthought library imports.
from traits.api import Bool, Instance, Interface, Unicode
from traits.api import Bool, Instance, Interface, Str

# Local imports.
from .i_undo_manager import IUndoManager
Expand All @@ -36,15 +36,15 @@ class ICommandStack(Interface):
# This is the name of the command that can be redone. It will be empty if
# there is no command that can be redone. It is maintained by the undo
# stack.
redo_name = Unicode
redo_name = Str

# This is the undo manager that manages this stack.
undo_manager = Instance(IUndoManager)

# This is the name of the command that can be undone. It will be empty if
# there is no command that can be undone. It is maintained by the undo
# stack.
undo_name = Unicode
undo_name = Str

###########################################################################
# 'ICommandStack' interface.
Expand Down
6 changes: 3 additions & 3 deletions apptools/undo/i_undo_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#------------------------------------------------------------------------------

# Enthought library imports.
from traits.api import Bool, Event, Instance, Int, Interface, Unicode
from traits.api import Bool, Event, Instance, Int, Interface, Str


class IUndoManager(Interface):
Expand All @@ -36,7 +36,7 @@ class IUndoManager(Interface):
# This is the name of the command that can be redone. It will be empty if
# there is no command that can be redone. It is maintained by the undo
# manager.
redo_name = Unicode
redo_name = Str

# This is the sequence number of the next command to be performed. It is
# incremented immediately before a command is invoked (by its 'do()'
Expand All @@ -50,7 +50,7 @@ class IUndoManager(Interface):
# This is the name of the command that can be undone. It will be empty if
# there is no command that can be undone. It is maintained by the undo
# manager.
undo_name = Unicode
undo_name = Str

###########################################################################
# 'IUndoManager' interface.
Expand Down
6 changes: 3 additions & 3 deletions apptools/undo/undo_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Enthought library imports.
from traits.api import Bool, Event, HasTraits, Instance, Int, Property, \
Unicode, provides
Str, provides

# Local imports.
from .i_undo_manager import IUndoManager
Expand All @@ -40,7 +40,7 @@ class UndoManager(HasTraits):
# This is the name of the command that can be redone. It will be empty if
# there is no command that can be redone. It is maintained by the undo
# manager.
redo_name = Property(Unicode)
redo_name = Property(Str)

# This is the sequence number of the next command to be performed. It is
# incremented immediately before a command is invoked (by its 'do()'
Expand All @@ -55,7 +55,7 @@ class UndoManager(HasTraits):
# This is the name of the command that can be undone. It will be empty if
# there is no command that can be undone. It is maintained by the undo
# manager.
undo_name = Property(Unicode)
undo_name = Property(Str)

###########################################################################
# 'IUndoManager' interface.
Expand Down
10 changes: 5 additions & 5 deletions docs/source/undo/Introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ interface.
be the currently active stack.

``undo_name``
This Unicode trait is the name of the command that can be undone, and will
This Str trait is the name of the command that can be undone, and will
be empty if there is no such command. It is maintained by the undo
manager.

``redo_name``
This Unicode trait is the name of the command that can be redone, and will
This Str trait is the name of the command that can be redone, and will
be empty if there is no such command. It is maintained by the undo
manager.

Expand Down Expand Up @@ -143,12 +143,12 @@ The ``CommandStack`` class is the default implementation of the
data is saved to disk for example).

``undo_name``
This Unicode trait is the name of the command that can be undone, and will
This Str trait is the name of the command that can be undone, and will
be empty if there is no such command. It is maintained by the command
stack.

``redo_name``
This Unicode trait is the name of the command that can be redone, and will
This Str trait is the name of the command that can be redone, and will
be empty if there is no such command. It is maintained by the command
stack.

Expand Down Expand Up @@ -199,7 +199,7 @@ any undoable/redoable command.
operates on. It is not used by the framework itself.

``name``
This Unicode trait is the name of the command as it will appear in any GUI
This Str trait is the name of the command as it will appear in any GUI
element (e.g. in the text of an undo and redo menu entry). It may include
``&`` to indicate a keyboard shortcut which will be automatically removed
whenever it is inappropriate.
Expand Down
Loading