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
4 changes: 2 additions & 2 deletions apptools/appscripting/action/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
# Description: <Enthought application scripting package component>
#------------------------------------------------------------------------------

from start_recording_action import StartRecordingAction
from stop_recording_action import StopRecordingAction
from .start_recording_action import StartRecordingAction
from .stop_recording_action import StopRecordingAction
12 changes: 6 additions & 6 deletions apptools/appscripting/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# Description: <Enthought application scripting package component>
#------------------------------------------------------------------------------

from scriptable_type import create_scriptable_type, make_object_scriptable
from i_bind_event import IBindEvent
from i_script_manager import IScriptManager
from package_globals import get_script_manager, set_script_manager
from script_manager import ScriptManager
from scriptable import scriptable, Scriptable
from .scriptable_type import create_scriptable_type, make_object_scriptable
from .i_bind_event import IBindEvent
from .i_script_manager import IScriptManager
from .package_globals import get_script_manager, set_script_manager
from .script_manager import ScriptManager
from .scriptable import scriptable, Scriptable
2 changes: 1 addition & 1 deletion apptools/appscripting/bind_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from traits.api import Any, HasTraits, provides, Str

# Local imports.
from i_bind_event import IBindEvent
from .i_bind_event import IBindEvent


@provides(IBindEvent)
Expand Down
2 changes: 1 addition & 1 deletion apptools/appscripting/i_script_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from traits.api import Bool, Event, Instance, Interface, Unicode

# Local imports.
from i_bind_event import IBindEvent
from .i_bind_event import IBindEvent


class IScriptManager(Interface):
Expand Down
6 changes: 3 additions & 3 deletions apptools/appscripting/lazy_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
from traits.api import Any, Callable, HasTraits

# Local imports.
from bind_event import BindEvent
from package_globals import get_script_manager
from scriptable_type import make_object_scriptable
from .bind_event import BindEvent
from .package_globals import get_script_manager
from .scriptable_type import make_object_scriptable


class FactoryWrapper(HasTraits):
Expand Down
2 changes: 1 addition & 1 deletion apptools/appscripting/package_globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_script_manager():
global _script_manager

if _script_manager is None:
from script_manager import ScriptManager
from .script_manager import ScriptManager

_script_manager = ScriptManager()

Expand Down
24 changes: 12 additions & 12 deletions apptools/appscripting/script_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
implements, Instance, Int, List, Property, Str, Unicode

# Local imports.
from bind_event import BindEvent
from i_bind_event import IBindEvent
from i_script_manager import IScriptManager
from lazy_namespace import add_to_namespace, FactoryWrapper, LazyNamespace
from scriptable_type import make_object_scriptable
from .bind_event import BindEvent
from .i_bind_event import IBindEvent
from .i_script_manager import IScriptManager
from .lazy_namespace import add_to_namespace, FactoryWrapper, LazyNamespace
from .scriptable_type import make_object_scriptable


@provides(IScriptManager)
Expand Down Expand Up @@ -405,11 +405,11 @@ def run(self, script):

# Initialise the namespace with all explicitly bound objects.
nspace = LazyNamespace()
for name, bo in self._namespace.iteritems():
for name, bo in self._namespace.items():
if bo.explicitly_bound:
add_to_namespace(bo.obj, name, nspace)

exec script in nspace
exec(script, nspace)

def run_file(self, file_name):
""" Run the given script file.
Expand Down Expand Up @@ -510,7 +510,7 @@ def new_object(self, obj, scripted_type, args=None, kwargs=None, name=None,
# Doing this now avoids problems with mutable arguments.
so.args = [self._scriptable_object_as_string(a) for a in args]

for n, value in kwargs.iteritems():
for n, value in kwargs.items():
so.kwargs[n] = self._scriptable_object_as_string(value)

so.explicitly_bound = False
Expand Down Expand Up @@ -540,7 +540,7 @@ def args_as_string_list(args, kwargs, so_needed=None):
s = ScriptManager.arg_as_string(arg, so_needed)
all_args.append(s)

for name, value in kwargs.iteritems():
for name, value in kwargs.items():
s = ScriptManager.arg_as_string(value, so_needed)
all_args.append('%s=%s' % (name, s))

Expand Down Expand Up @@ -589,10 +589,10 @@ def _new_method(self, func, args, kwargs):
nargs = nargs[1:]

nkwargs = {}
for name, value in kwargs.iteritems():
for name, value in kwargs.items():
nkwargs[name] = self._object_as_string(value)

return _ScriptMethod(name=func.func_name, so=so, args=nargs,
return _ScriptMethod(name=func.__name__, so=so, args=nargs,
kwargs=nkwargs)

def _add_method(self, entry, result):
Expand Down Expand Up @@ -691,7 +691,7 @@ def _gc_script_obj(obj_ref):
"""

# Avoid recursive imports.
from package_globals import get_script_manager
from .package_globals import get_script_manager

sm = get_script_manager()
so = sm._so_by_ref[obj_ref]
Expand Down
4 changes: 2 additions & 2 deletions apptools/appscripting/scriptable.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from traits.traits import trait_cast

# Local imports.
from package_globals import get_script_manager
from .package_globals import get_script_manager


# This is the guard that ensures that only outermost scriptable methods get
Expand All @@ -44,7 +44,7 @@ def _scripter(*args, **kwargs):
# See if there is an script manager set.
sm = get_script_manager()

if func.func_name == '__init__':
if func.__name__ == '__init__':
sm.new_object(args[0], type(args[0]), args[1:], kwargs)

try:
Expand Down
6 changes: 3 additions & 3 deletions apptools/appscripting/scriptable_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from traits.api import HasTraits

# Local imports.
from package_globals import get_script_manager
from scriptable import scriptable, Scriptable
from .package_globals import get_script_manager
from .scriptable import scriptable, Scriptable


def create_scriptable_type(scripted_type, name=None, bind_policy='auto',
Expand Down Expand Up @@ -98,7 +98,7 @@ def __init__(self, *args, **kwargs):
except KeyError:
pass

names = ndict.keys()
names = list(ndict.keys())

# Create the type dictionary containing replacements for everything that
# needs to be scriptable.
Expand Down
4 changes: 2 additions & 2 deletions apptools/help/help_plugin/action/demo_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# This module's parent package.
PARENT = '.'.join(__name__.split('.')[:-2])

from util import get_sys_prefix_relative_filename
from .util import get_sys_prefix_relative_filename

# Implementation of the ImageResource class to be used for the DocAction class.
@provides(IExtensionPointUser)
Expand Down Expand Up @@ -87,7 +87,7 @@ def perform(self, event):
if filename is not None:
try:
Popen([sys.executable, filename])
except OSError, err:
except OSError as err:
logger.error(
'Could not execute Python file for Demo "%s".\n\n' \
% self.my_help_code.label + str(err) + \
Expand Down
6 changes: 3 additions & 3 deletions apptools/help/help_plugin/action/doc_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from apptools.help.help_plugin.api import HelpDoc

# Local imports
from util import get_sys_prefix_relative_filename
from .util import get_sys_prefix_relative_filename

# Logging.
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -100,15 +100,15 @@ def perform(self, event):
import webbrowser
try:
webbrowser.open(filename)
except (OSError, webbrowser.Error), msg:
except (OSError, webbrowser.Error) as msg:
logger.error('Could not open page in browser for '+ \
'Document "%s":\n\n' % self.my_help_doc.label + \
str(msg) + '\n\nTry changing Dcoument Preferences.')
elif self.my_help_doc.viewer is not None:
# Run the viewer, passing it the filename
try:
Popen([self.my_help_doc.viewer, filename])
except OSError, msg:
except OSError as msg:
logger.error('Could not execute program for Document' + \
' "%s":\n\n ' % self.my_help_doc.label + str(msg) + \
'\n\nTry changing Document Preferences.')
4 changes: 2 additions & 2 deletions apptools/help/help_plugin/action/example_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
ExamplesPreferences

# Local import
from util import get_sys_prefix_relative_filename
from .util import get_sys_prefix_relative_filename

# Logging.
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -71,7 +71,7 @@ def perform(self, event):
# Run the editor, passing it the filename
try:
Popen([self.preferences.editor, filename])
except OSError, err:
except OSError as err:
logger.error(
'Could not execute program for Example "%s":\n\n ' \
% self.my_help_code.label + str(err) + '\n\nTry ' +\
Expand Down
5 changes: 3 additions & 2 deletions apptools/help/help_plugin/action/load_url_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!

# Enthought library imports.
from doc_action import DocAction
# Local imports.
from .doc_action import DocAction

# This module's parent package.
PARENT = '.'.join(__name__.split('.')[:-2])


class LoadURLAction(DocAction):
""" Workbench Action for displaying a url in a web browser.
"""
Expand Down
10 changes: 5 additions & 5 deletions apptools/help/help_plugin/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!

from help_code import HelpCode
from help_doc import HelpDoc
from help_plugin import HelpPlugin
from i_help_code import IHelpCode
from i_help_doc import IHelpDoc
from .help_code import HelpCode
from .help_doc import HelpDoc
from .help_plugin import HelpPlugin
from .i_help_code import IHelpCode
from .i_help_doc import IHelpDoc
5 changes: 3 additions & 2 deletions apptools/help/help_plugin/help_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!

from apptools.preferences.api import PreferencesHelper
from traits.api import File, Str, provides

from i_help_code import IHelpCode
from apptools.preferences.api import PreferencesHelper
from .i_help_code import IHelpCode


@provides(IHelpCode)
class HelpCode(PreferencesHelper):
Expand Down
5 changes: 3 additions & 2 deletions apptools/help/help_plugin/help_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!

from apptools.preferences.api import PreferencesHelper
from traits.api import Either, File, Str, provides, Bool

from i_help_doc import IHelpDoc
from apptools.preferences.api import PreferencesHelper
from .i_help_doc import IHelpDoc


@provides(IHelpDoc)
class HelpDoc(PreferencesHelper):
Expand Down
8 changes: 4 additions & 4 deletions apptools/help/help_plugin/help_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
from traits.api import Instance, List, Str

# Local imports
from help_code import HelpCode
from help_doc import HelpDoc
from i_help_code import IHelpCode
from i_help_doc import IHelpDoc
from .help_code import HelpCode
from .help_doc import HelpDoc
from .i_help_code import IHelpCode
from .i_help_doc import IHelpDoc

# Logging.
logger = logging.getLogger(__name__)
Expand Down
14 changes: 7 additions & 7 deletions apptools/help/help_plugin/help_submenu_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
from traits.api import Any, provides, Instance, List, Property

# Local imports.
from action.doc_action import DocAction
from action.demo_action import DemoAction
from action.example_action import ExampleAction
from action.load_url_action import LoadURLAction
from examples_preferences import ExamplesPreferences
from i_help_doc import IHelpDoc
from i_help_code import IHelpCode
from .action.doc_action import DocAction
from .action.demo_action import DemoAction
from .action.example_action import ExampleAction
from .action.load_url_action import LoadURLAction
from .examples_preferences import ExamplesPreferences
from .i_help_doc import IHelpDoc
from .i_help_code import IHelpCode

# Logging.
logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion apptools/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
""" Provides an abstraction for files and folders in a file system.
Part of the AppTools project of the Enthought Tool Suite.
"""
from api import *
from apptools.io.api import *
2 changes: 1 addition & 1 deletion apptools/io/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
# Author: Enthought, Inc.
# Description: <Enthought IO package component>
#------------------------------------------------------------------------------
from file import File
from .file import File
6 changes: 5 additions & 1 deletion apptools/io/h5/dict_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,12 @@ def _handle_array_values(cls, pyt_file, group_path, data):

# Remove stored arrays which are no longer in the data dictionary.
pyt_children = group._v_children
nodes_to_remove = []
for key in pyt_children.keys():
if key not in data:
pyt_file.remove_node(group, key)
nodes_to_remove.append(key)

for key in nodes_to_remove:
pyt_file.remove_node(group, key)

return out_data
4 changes: 2 additions & 2 deletions apptools/io/h5/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,11 @@ def root(self):

@property
def children_names(self):
return self._h5_group._v_children.keys()
return list(self._h5_group._v_children.keys())

@property
def subgroup_names(self):
return self._h5_group._v_groups.keys()
return list(self._h5_group._v_groups.keys())

def iter_groups(self):
""" Iterate over `H5Group` nodes that are children of this group. """
Expand Down
5 changes: 3 additions & 2 deletions apptools/io/h5/table_node.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
from pandas import DataFrame
import six
Comment thread
rahulporuri marked this conversation as resolved.
from tables.table import Table as PyTablesTable


Expand Down Expand Up @@ -78,7 +79,7 @@ def append(self, data):
data : dict
A dictionary of column name -> values items
"""
rows = zip(*[data[name] for name in self.keys()])
rows = list(zip(*[data[name] for name in self.keys()]))
self._h5_table.append(rows)

def __getitem__(self, col_or_cols):
Expand All @@ -95,7 +96,7 @@ def __getitem__(self, col_or_cols):
An array of column data with the column order matching that of
`col_or_cols`.
"""
if isinstance(col_or_cols, basestring):
if isinstance(col_or_cols, six.string_types):
return self._h5_table.col(col_or_cols)

column_data = [self._h5_table.col(name) for name in col_or_cols]
Expand Down
Loading