1
#------------------------------------------------------------------------------
2
# Copyright (c) 2005, Enthought, Inc.
5
# This software is provided without warranty under the terms of the BSD
6
# license included in enthought/LICENSE.txt and may be redistributed only
7
# under the conditions described in the aforementioned license. The license
8
# is also available online at http://www.enthought.com/licenses/BSD.txt
9
# Thanks for using Enthought open source!
11
# Author: Enthought, Inc.
12
# Description: <Enthought naming package component>
13
#------------------------------------------------------------------------------
14
""" The initial context factory for Python file system contexts. """
18
from context import Context
19
from initial_context_factory import InitialContextFactory
20
from object_serializer import ObjectSerializer
21
from pyfs_context import PyFSContext
22
from pyfs_context_factory import PyFSContextFactory
23
from pyfs_object_factory import PyFSObjectFactory
24
from pyfs_state_factory import PyFSStateFactory
27
class PyFSInitialContextFactory(InitialContextFactory):
28
""" The initial context factory for Python file system contexts. """
30
###########################################################################
31
# 'InitialContextFactory' interface.
32
###########################################################################
34
def get_initial_context(self, environment):
35
""" Creates an initial context for beginning name resolution. """
38
object_factories = [PyFSObjectFactory(), PyFSContextFactory()]
39
environment[Context.OBJECT_FACTORIES] = object_factories
42
state_factories = [PyFSStateFactory()]
43
environment[Context.STATE_FACTORIES] = state_factories
46
object_serializers = [ObjectSerializer()]
47
environment[PyFSContext.OBJECT_SERIALIZERS] = object_serializers
49
return PyFSContext(path=r'', environment=environment)
51
#### EOF ######################################################################