Skip to content

Namespace branch unification#26

Merged
chisholm merged 18 commits intomixbox_namespaces_revampfrom
one_pass_namespaces
Mar 4, 2016
Merged

Namespace branch unification#26
chisholm merged 18 commits intomixbox_namespaces_revampfrom
one_pass_namespaces

Conversation

@chisholm
Copy link
Contributor

@chisholm chisholm commented Mar 4, 2016

There have been two namespace-related branches. The first was about factoring out XML namespace handling into mixbox and making other projects use mixbox's capabilities instead of each reinventing it separately. The second was about making sure the projects were collecting namespace data and generating binding object graphs in the same pass, to improve performance. I wanted the latter task to be based on the new code introduced in the former task, so the latter branched off the former.

I need to merge this whole namespace-related ball of changes together, in preparation for another merge with another out-standing branch. I'm going to merge one_pass into the namespace_revamp branch, to create one big namespace-related change branch.

chisholm and others added 18 commits October 9, 2015 13:22
I use it to enable one-pass namespace collection in mixbox's
Entity.to_xml method.
methods, since it turned out there are some python-cybox
tests which use them.  They don't seem to be used anywhere else;
makes me think maybe the tests should be rewritten...
checks only entity subclasses.  This is to avoid having to
import anything from stix (in particular, stix.Entity).

Also, some tests are moved from python-stix to this library,
since they were tests of its NamespaceInfo class (now,
mixbox's NamespaceCollector).
* Added __contains__ to NamespaceSet.
* _NamespaceInfo.prefixes is an OrderedSet now. This reduces issues
  that can arise when determining the preferred_prefix for a
  namespace when ``next(iter(namespaceinfo.prefixes))`` is used.
* Added docstrings to lookup_prefix and lookup_namespace functions.
* Some code-style changes: guard clauses used to reduce if/elif/else
  block nesting in loops; kwargs used when passing in literals to
  multi-parameter functions; use parens for multi-line conditions
  rather than backslashes; etc.
* Removed  Entity._get_children() and Entity._get_namespaces()
  as they are no longer used outside of two python-cybox tests
  and are no longer a part of the namespace collection/generation
  workflow.
Looks like he was trying to add more container emulation to
NamespaceSet.  He'd only got so far as adding __contains__(), but
it also suggests possibly defining __iter__() too.

Looks like he'd allowed __contains__() to work on a _NamespaceInfo,
but I don't agree that public functions should work with that
internal type.  Someone might think it's okay to do that...  So I
removed that functionality.  Now, it's essentially equivalent to
the existing contains_namespace() function, supporting only a
namespace URI string.
OrderedSet instead of the built-in python set.  I think he didn't
finish: he changed __default_construct() but never changed
__construct_from_components().  So I updated the latter method.
chisholm added a commit that referenced this pull request Mar 4, 2016
@chisholm chisholm merged commit b181dbe into mixbox_namespaces_revamp Mar 4, 2016
@chisholm chisholm deleted the one_pass_namespaces branch March 4, 2016 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant