Package pyxb :: Package namespace :: Module archive :: Class NamespaceArchive
[hide private]
[frames] | no frames]

Class NamespaceArchive

source code

object --+
         |
        NamespaceArchive

Represent a file from which one or more namespaces can be read, or to which they will be written.

Instance Methods [hide private]
 
discard(self)
Remove this archive from the set of available archives.
source code
 
archivePath(self)
Path to the file in which this namespace archive is stored.
source code
 
generationUID(self)
The unique identifier for the generation that produced this archive.
source code
 
isLoadable(self)
Return True iff it is permissible to load the archive.
source code
 
__locateModuleRecords(self) source code
 
moduleRecords(self)
Return the set of module records stored in this archive.
source code
 
_stage(self) source code
 
__init__(self, archive_path=None, generation_uid=None, loadable=True, stage=None)
Create a new namespace archive.
source code
 
add(self, namespace)
Add the given namespace to the set that is to be stored in this archive.
source code
 
update(self, namespace_set)
Add the given namespaces to the set that is to be stored in this archive.
source code
 
namespaces(self)
Set of namespaces that can be read from this archive.
source code
 
__createPickler(self, output) source code
 
__createUnpickler(self) source code
 
__readModules(self, unpickler) source code
 
_unsatisfiedModulePrerequisites(self) source code
 
__validatePrerequisites(self, stage) source code
 
__validateModules(self) source code
 
__readComponentSet(self, unpickler) source code
 
_readToStage(self, stage) source code
 
readNamespaces(self)
Read all the components from this archive, integrating them into their respective namespaces.
source code
 
writeNamespaces(self, output)
Store the namespaces into the archive.
source code
 
__str__(self)
str(x)
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Methods [hide private]
 
_AnonymousCategory(cls)
The category name to use when storing references to anonymous type definitions.
source code
 
PicklingArchive(cls)
Return a reference to a set specifying the namespace instances that are being archived.
source code
 
__GetArchiveInstance(cls, archive_file, stage=None)
Return a NamespaceArchive instance associated with the given file.
source code
 
PreLoadArchives(cls, archive_path=None, required_archive_files=None, reset=False)
Scan for available archives, associating them with namespaces.
source code
 
ForPath(cls, archive_file)
Return the NamespaceArchive instance that can be found at the given path.
source code
Class Variables [hide private]
  __PickleFormat = '200907190858'
  __AnonymousCategory = '_anonymousTypeDefinition'
  __PicklingArchive = None
hash(x)
  __NamespaceArchives = None
A mapping from generation UID to NamespaceArchive instances.
  __ArchivePattern_re = re.compile(r'\.wxs$')
  __archivePath = None
hash(x)
  __generationUID = None
hash(x)
  __isLoadable = None
hash(x)
  __moduleRecords = None
hash(x)
  _STAGE_UNOPENED = 0
  _STAGE_uid = 1
  _STAGE_readModules = 2
  _STAGE_validateModules = 3
  _STAGE_readComponents = 4
  _STAGE_COMPLETE = 4
  __stage = None
hash(x)
  __namespaces = None
hash(x)
  __unpickler = None
hash(x)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

_AnonymousCategory(cls)
Class Method

source code 

The category name to use when storing references to anonymous type definitions. For example, attribute definitions defined within an attribute use in a model group definition.that can be referenced frojm ax different namespace.

PicklingArchive(cls)
Class Method

source code 

Return a reference to a set specifying the namespace instances that are being archived.

This is needed to determine whether a component must be serialized as aa reference.

discard(self)

source code 

Remove this archive from the set of available archives.

This is invoked when an archive contains a namespace that the user has specified should not be loaded.

__GetArchiveInstance(cls, archive_file, stage=None)
Class Method

source code 

Return a NamespaceArchive instance associated with the given file.

To the extent possible, the same file accessed through different paths returns the same NamespaceArchive instance.

PreLoadArchives(cls, archive_path=None, required_archive_files=None, reset=False)
Class Method

source code 

Scan for available archives, associating them with namespaces.

This only validates potential archive contents; it does not load namespace data from the archives. If invoked with no arguments,

Parameters:
  • archive_path - A list of files or directories in which namespace archives can be found. The entries are separated by os.pathsep, which is a colon on POSIX platforms and a semi-colon on Windows. See PathEnvironmentVariable. Defaults to GetArchivePath(). If not defaulted, reset will be forced to True. For any directory in the path, all files ending with .wxs are examined.
  • required_archive_files - A list of paths to files that must resolve to valid namespace archives.
  • reset - If False (default), the most recently read set of archives is returned; if True, the archive path is re-scanned and the namespace associations validated.
Returns:
A list of NamespaceArchive instances corresponding to the members of required_archive_files, in order. If required_archive_files was not provided, returns an empty list.
Raises:
  • pickle.UnpicklingError - a required_archive_files member does not contain a valid namespace archive.

isLoadable(self)

source code 

Return True iff it is permissible to load the archive. Archives created for output cannot be loaded.

moduleRecords(self)

source code 

Return the set of module records stored in this archive.

Each module record represents

__init__(self, archive_path=None, generation_uid=None, loadable=True, stage=None)
(Constructor)

source code 

Create a new namespace archive.

If namespaces is given, this is an output archive.

If namespaces is absent, this is an input archive.

Raises:
  • IOError - error attempting to read the archive file
  • pickle.UnpicklingError - something is wrong with the format of the library
Overrides: object.__init__

writeNamespaces(self, output)

source code 

Store the namespaces into the archive.

Parameters:
  • output - An instance substitutable for a writable file, or the name of a file to write to.

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)