[Python-modules-commits] [python-pygraphviz] 01/12: Import python-pygraphviz_1.3.1.orig.tar.gz

Sandro Tosi morph at moszumanska.debian.org
Sun Jan 3 02:10:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

morph pushed a commit to branch master
in repository python-pygraphviz.

commit 52fefaeba987b9d80c1473e9431c06b160ea3af4
Author: Sandro Tosi <morph at debian.org>
Date:   Sun Jan 3 01:09:14 2016 +0000

    Import python-pygraphviz_1.3.1.orig.tar.gz
---
 INSTALL.txt                              |  18 +-
 LICENSE                                  |  34 ++++
 MANIFEST.in                              |  13 +-
 Makefile                                 |  14 ++
 PKG-INFO                                 |   6 +-
 README.txt => README.rst                 |   2 +-
 doc/source/index.rst                     |   1 +
 doc/source/reference/news.rst            |  12 +-
 doc/source/static/contents.png           | Bin 0 -> 202 bytes
 doc/source/static/navigation.png         | Bin 0 -> 218 bytes
 doc/source/static/sphinxdoc.css          | 328 +++++++++++++++++++++++++++++++
 PKG-INFO => pygraphviz.egg-info/PKG-INFO |   6 +-
 pygraphviz.egg-info/SOURCES.txt          |  70 +++++++
 pygraphviz.egg-info/dependency_links.txt |   1 +
 pygraphviz.egg-info/top_level.txt        |   1 +
 pygraphviz/__init__.py                   |   5 +-
 pygraphviz/agraph.py                     |  57 +++---
 pygraphviz/graphviz.i                    | 302 ++++++++++++++++++++++++++++
 pygraphviz/graphviz.py                   |   2 +-
 pygraphviz/graphviz_wrap.c               |  16 +-
 pygraphviz/release.py                    |   7 +-
 pygraphviz/tests/test_clear.py           |  31 +++
 pygraphviz/tests/test_edge_attributes.py |  23 +++
 pygraphviz/tests/test_graph.py           |   2 +-
 pygraphviz/tests/test_node_attributes.py |  23 +++
 pygraphviz/tests/test_string.py          |   7 +-
 pygraphviz/tests/test_subgraph.py        |  15 ++
 pygraphviz/version.py                    |   4 +-
 pystrings.swg                            |  86 ++++++++
 setup.cfg                                |  21 +-
 setup.py                                 | 127 +++---------
 setup_commands.py                        |  65 ++++++
 setup_egg.py                             |  61 ------
 setup_extra.py                           | 165 ++++++++++++----
 tox.ini                                  |   9 +
 35 files changed, 1269 insertions(+), 265 deletions(-)

diff --git a/INSTALL.txt b/INSTALL.txt
index 217c9c2..d13b7ff 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -30,6 +30,21 @@ or install it with::
 and an attempt will be made to find and install an appropriate version
 that matches your operating system and Python version. 
 
+Providing path to graphviz
+--------------------------
+
+We tried our best to discover graphviz location automatically, but if you 
+would like specify specific location for graphviz you may provide additrional parameters to specify graphviz location
+
+
+include-path= path to graphviz include files
+library-path= path to graphviz library files
+
+For example
+
+::
+
+    python setup.py install --include-path=/usr/local/Cellar/graphviz/2.38.0/include/graphviz --library-path=/usr/local/Cellar/graphviz/2.38.0/lib
 
 Installing from Source
 ======================
@@ -91,8 +106,7 @@ Requirements
 Python
 ------
 
-To use PyGraphviz you need Python version 2.6.x or 2.7.x.
-PyGraphviz does not work with Python 3
+PyGraphviz is tested and works with Python 2.7 and Python 3.4. It may work correctly with other Python 3.x versions.
 
 The easiest way to get Python and most optional packages is to install
 the Enthought Python distribution "Canopy"
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..632d856
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,34 @@
+Copyright (C) 2004-2015 by
+Aric Hagberg <hagberg at lanl.gov>
+Dan Schult <dschult at colgate.edu>
+Manos Renieris, http://www.cs.brown.edu/~er/
+Distributed with BSD license.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+  * Redistributions in binary form must reproduce the above
+    copyright notice, this list of conditions and the following
+    disclaimer in the documentation and/or other materials provided
+    with the distribution.
+
+  * Neither the name of the <ORGANIZATION> nor the names of its
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/MANIFEST.in b/MANIFEST.in
index 8fe67cc..27ef2af 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,10 +1,17 @@
 include MANIFEST.in
-include setup_egg.py
-include setup_extra.py
 include INSTALL.txt
+include README.rst
+include LICENSE
 
+include *.py
+include *.swg
+include Makefile
+include tox.ini
+
+recursive-include doc *.png
+recursive-include pygraphviz *.i
 recursive-include examples *.py *.gz 
-recursive-include doc *.py *.rst Makefile *.html *.txt
+recursive-include doc *.py *.rst Makefile *.html *.txt *.css 
 
 global-exclude *~
 global-exclude *.pyc
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1f6f6b7
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,14 @@
+all:
+
+swig:
+	swig -python pygraphviz/graphviz.i
+	# DOS endings to not corrupt the diff.
+	@unix2dos pygraphviz/graphviz.py
+	@unix2dos pygraphviz/graphviz_wrap.c
+
+# Clean all build and test artifacts.
+clean c:
+	rm -rf build *.pyc *.egg-info MANIFEST .noseids __pycache__ .tox
+	find pygraphviz -name '*.pyc' -delete
+	find pygraphviz -name '*.so' -delete
+	find pygraphviz -name '__pycache__' -type d | xargs --no-run-if-empty rm -r
diff --git a/PKG-INFO b/PKG-INFO
index 092be4c..92a7cd9 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pygraphviz
-Version: 1.3rc2
+Version: 1.3.1
 Summary: Python interface to Graphviz
 Home-page: http://pygraphviz.github.io
 Author: Aric Hagberg
@@ -12,6 +12,7 @@ Description: PyGraphviz is a Python interface to the Graphviz graph layout and v
 Keywords: Networks,Graph Visualization,network,graph,graph drawing
 Platform: Linux
 Platform: Mac OSX
+Platform: Microsoft :: Windows
 Classifier: Development Status :: 4 - Beta
 Classifier: Intended Audience :: Developers
 Classifier: Intended Audience :: Science/Research
@@ -19,11 +20,8 @@ Classifier: License :: OSI Approved :: BSD License
 Classifier: Programming Language :: C
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.2
-Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Classifier: Topic :: Scientific/Engineering :: Information Analysis
diff --git a/README.txt b/README.rst
similarity index 94%
rename from README.txt
rename to README.rst
index fe05f25..faac34d 100644
--- a/README.txt
+++ b/README.rst
@@ -9,7 +9,7 @@ Python to access the Graphviz graph data structure and layout algorithms.
 
 PyGraphviz is distributed with a BSD license.
 
-Copyright (C) 2006-2014 by 
+Copyright (C) 2006-2015 by 
 Aric Hagberg <aric.hagberg at gmail.gov>
 Dan Schult <dschult at colgate.edu>
 Manos Renieris, http://www.cs.brown.edu/~er/
diff --git a/doc/source/index.rst b/doc/source/index.rst
index 6208689..67a738e 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -17,6 +17,7 @@ PyGraphviz documentation
    :maxdepth: 2
 
    
+   download
    install
    tutorial
    reference/index
diff --git a/doc/source/reference/news.rst b/doc/source/reference/news.rst
index be88bce..a501791 100644
--- a/doc/source/reference/news.rst
+++ b/doc/source/reference/news.rst
@@ -2,13 +2,23 @@
 
 News
 ==== 
+pygraphviz-1.3.1
+----------------
+Release date: 6 September 2015
+
+ - Update manifest to include missing files
+
+
+
 pygraphviz-1.3
 --------------
-Release date: TBD
+Release date: 5 September 2015
 
  - Python 3 support
  - Encoding bugfixes
 
+https://github.com/pygraphviz/pygraphviz/issues?q=milestone%3Apygraphivz-1.3+is%3Aclosed
+
 
 pygraphviz-1.2
 -----------------
diff --git a/doc/source/static/contents.png b/doc/source/static/contents.png
new file mode 100644
index 0000000..7fb8215
Binary files /dev/null and b/doc/source/static/contents.png differ
diff --git a/doc/source/static/navigation.png b/doc/source/static/navigation.png
new file mode 100644
index 0000000..1081dc1
Binary files /dev/null and b/doc/source/static/navigation.png differ
diff --git a/doc/source/static/sphinxdoc.css b/doc/source/static/sphinxdoc.css
new file mode 100644
index 0000000..3f1e84e
--- /dev/null
+++ b/doc/source/static/sphinxdoc.css
@@ -0,0 +1,328 @@
+/*
+ * sphinxdoc.css_t
+ * ~~~~~~~~~~~~~~~
+ *
+ * Sphinx stylesheet -- sphinxdoc theme.  Originally created by
+ * Armin Ronacher for Werkzeug.
+ *
+ * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
+ * :license: BSD, see LICENSE for details.
+ *
+ */
+
+ at import url("basic.css");
+
+/* -- page layout ----------------------------------------------------------- */
+
+body {
+    font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva',
+                 'Verdana', sans-serif;
+    font-size: 14px;
+    letter-spacing: -0.01em;
+    line-height: 150%;
+    text-align: center;
+    background-color: #BFD1D4;
+    color: black;
+    padding: 0;
+    border: 1px solid #aaa;
+
+    margin: 0px 80px 0px 80px;
+    min-width: 740px;
+}
+
+div.document {
+    background-color: white;
+    text-align: left;
+    background-image: url(contents.png);
+    background-repeat: repeat-x;
+}
+
+div.bodywrapper {
+    margin: 0 240px 0 0;
+    border-right: 1px solid #ccc;
+}
+
+div.body {
+    margin: 0;
+    padding: 0.5em 20px 20px 20px;
+}
+
+div.related {
+    font-size: 1em;
+}
+
+div.related ul {
+    background-image: url(navigation.png);
+    height: 2em;
+    border-top: 1px solid #ddd;
+    border-bottom: 1px solid #ddd;
+}
+
+div.related ul li {
+    margin: 0;
+    padding: 0;
+    height: 2em;
+    float: left;
+}
+
+div.related ul li.right {
+    float: right;
+    margin-right: 5px;
+}
+
+div.related ul li a {
+    margin: 0;
+    padding: 0 5px 0 5px;
+    line-height: 1.75em;
+    color: #EE9816;
+}
+
+div.related ul li a:hover {
+    color: #3CA8E7;
+}
+
+div.sphinxsidebarwrapper {
+    padding: 0;
+}
+
+div.sphinxsidebar {
+    margin: 0;
+    padding: 0.5em 15px 15px 0;
+    width: 210px;
+    float: right;
+    font-size: 1em;
+    text-align: left;
+}
+
+div.sphinxsidebar h3, div.sphinxsidebar h4 {
+    margin: 1em 0 0.5em 0;
+    font-size: 1em;
+    padding: 0.1em 0 0.1em 0.5em;
+    color: white;
+    border: 1px solid #86989B;
+    background-color: #AFC1C4;
+}
+
+div.sphinxsidebar h3 a {
+    color: white;
+}
+
+div.sphinxsidebar ul {
+    padding-left: 1.5em;
+    margin-top: 7px;
+    padding: 0;
+    line-height: 130%;
+}
+
+div.sphinxsidebar ul ul {
+    margin-left: 20px;
+}
+
+div.footer {
+    background-color: #E3EFF1;
+    color: #86989B;
+    padding: 3px 8px 3px 0;
+    clear: both;
+    font-size: 0.8em;
+    text-align: right;
+}
+
+div.footer a {
+    color: #86989B;
+    text-decoration: underline;
+}
+
+/* -- body styles ----------------------------------------------------------- */
+
+p {    
+    margin: 0.8em 0 0.5em 0;
+}
+
+a {
+    color: #CA7900;
+    text-decoration: none;
+}
+
+a:hover {
+    color: #2491CF;
+}
+
+div.body a {
+    text-decoration: underline;
+}
+
+h1 {
+    margin: 0;
+    padding: 0.7em 0 0.3em 0;
+    font-size: 1.5em;
+    color: #11557C;
+}
+
+h2 {
+    margin: 1.3em 0 0.2em 0;
+    font-size: 1.35em;
+    padding: 0;
+}
+
+h3 {
+    margin: 1em 0 -0.3em 0;
+    font-size: 1.2em;
+}
+
+div.body h1 a, div.body h2 a, div.body h3 a, div.body h4 a, div.body h5 a, div.body h6 a {
+    color: black!important;
+}
+
+h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor {
+    display: none;
+    margin: 0 0 0 0.3em;
+    padding: 0 0.2em 0 0.2em;
+    color: #aaa!important;
+}
+
+h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor,
+h5:hover a.anchor, h6:hover a.anchor {
+    display: inline;
+}
+
+h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover,
+h5 a.anchor:hover, h6 a.anchor:hover {
+    color: #777;
+    background-color: #eee;
+}
+
+a.headerlink {
+    color: #c60f0f!important;
+    font-size: 1em;
+    margin-left: 6px;
+    padding: 0 4px 0 4px;
+    text-decoration: none!important;
+}
+
+a.headerlink:hover {
+    background-color: #ccc;
+    color: white!important;
+}
+
+cite, code, tt {
+    font-family: 'Consolas', 'Deja Vu Sans Mono',
+                 'Bitstream Vera Sans Mono', monospace;
+    font-size: 0.95em;
+    letter-spacing: 0.01em;
+}
+
+tt {
+    background-color: #f2f2f2;
+    border-bottom: 1px solid #ddd;
+    color: #333;
+}
+
+tt.descname, tt.descclassname, tt.xref {
+    border: 0;
+}
+
+hr {
+    border: 1px solid #abc;
+    margin: 2em;
+}
+
+a tt {
+    border: 0;
+    color: #CA7900;
+}
+
+a tt:hover {
+    color: #2491CF;
+}
+
+pre {
+    font-family: 'Consolas', 'Deja Vu Sans Mono',
+                 'Bitstream Vera Sans Mono', monospace;
+    font-size: 0.95em;
+    letter-spacing: 0.015em;
+    line-height: 120%;
+    padding: 0.5em;
+    border: 1px solid #ccc;
+    background-color: #f8f8f8;
+}
+
+pre a {
+    color: inherit;
+    text-decoration: underline;
+}
+
+td.linenos pre {
+    padding: 0.5em 0;
+}
+
+div.quotebar {
+    background-color: #f8f8f8;
+    max-width: 250px;
+    float: right;
+    padding: 2px 7px;
+    border: 1px solid #ccc;
+}
+
+div.topic {
+    background-color: #f8f8f8;
+}
+
+table {
+    border-collapse: collapse;
+    margin: 0 -0.5em 0 -0.5em;
+}
+
+table td, table th {
+    padding: 0.2em 0.5em 0.2em 0.5em;
+}
+
+div.admonition, div.warning {
+    font-size: 0.9em;
+    margin: 1em 0 1em 0;
+    border: 1px solid #86989B;
+    background-color: #f7f7f7;
+    padding: 0;
+}
+
+div.admonition p, div.warning p {
+    margin: 0.5em 1em 0.5em 1em;
+    padding: 0;
+}
+
+div.admonition pre, div.warning pre {
+    margin: 0.4em 1em 0.4em 1em;
+}
+
+div.admonition p.admonition-title,
+div.warning p.admonition-title {
+    margin: 0;
+    padding: 0.1em 0 0.1em 0.5em;
+    color: white;
+    border-bottom: 1px solid #86989B;
+    font-weight: bold;
+    background-color: #AFC1C4;
+}
+
+div.warning {
+    border: 1px solid #940000;
+}
+
+div.warning p.admonition-title {
+    background-color: #CF0000;
+    border-bottom-color: #940000;
+}
+
+div.admonition ul, div.admonition ol,
+div.warning ul, div.warning ol {
+    margin: 0.1em 0.5em 0.5em 3em;
+    padding: 0;
+}
+
+div.versioninfo {
+    margin: 1em 0 0 0;
+    border: 1px solid #ccc;
+    background-color: #DDEAF0;
+    padding: 8px;
+    line-height: 1.3em;
+    font-size: 0.9em;
+}
diff --git a/PKG-INFO b/pygraphviz.egg-info/PKG-INFO
similarity index 89%
copy from PKG-INFO
copy to pygraphviz.egg-info/PKG-INFO
index 092be4c..92a7cd9 100644
--- a/PKG-INFO
+++ b/pygraphviz.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pygraphviz
-Version: 1.3rc2
+Version: 1.3.1
 Summary: Python interface to Graphviz
 Home-page: http://pygraphviz.github.io
 Author: Aric Hagberg
@@ -12,6 +12,7 @@ Description: PyGraphviz is a Python interface to the Graphviz graph layout and v
 Keywords: Networks,Graph Visualization,network,graph,graph drawing
 Platform: Linux
 Platform: Mac OSX
+Platform: Microsoft :: Windows
 Classifier: Development Status :: 4 - Beta
 Classifier: Intended Audience :: Developers
 Classifier: Intended Audience :: Science/Research
@@ -19,11 +20,8 @@ Classifier: License :: OSI Approved :: BSD License
 Classifier: Programming Language :: C
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.2
-Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Classifier: Topic :: Scientific/Engineering :: Information Analysis
diff --git a/pygraphviz.egg-info/SOURCES.txt b/pygraphviz.egg-info/SOURCES.txt
new file mode 100644
index 0000000..91765a1
--- /dev/null
+++ b/pygraphviz.egg-info/SOURCES.txt
@@ -0,0 +1,70 @@
+INSTALL.txt
+LICENSE
+MANIFEST.in
+Makefile
+README.rst
+pystrings.swg
+setup.cfg
+setup.py
+setup_commands.py
+setup_extra.py
+tox.ini
+doc/Makefile
+doc/gh-pages.py
+doc/source/conf.py
+doc/source/download.rst
+doc/source/examples.rst
+doc/source/index.rst
+doc/source/install.rst
+doc/source/tutorial.rst
+doc/source/reference/agraph.rst
+doc/source/reference/api_notes.rst
+doc/source/reference/credits.rst
+doc/source/reference/faq.rst
+doc/source/reference/history.rst
+doc/source/reference/index.rst
+doc/source/reference/legal.rst
+doc/source/reference/news.rst
+doc/source/reference/related.rst
+doc/source/static/contents.png
+doc/source/static/empty.txt
+doc/source/static/navigation.png
+doc/source/static/sphinxdoc.css
+doc/source/templates/index.html
+doc/source/templates/indexsidebar.html
+doc/source/templates/layout.html
+doc/sphinxext/only_directives.py
+examples/attributes.py
+examples/django_simple.py
+examples/miles.py
+examples/miles_dat.txt.gz
+examples/simple.py
+examples/star.py
+examples/subgraph.py
+examples/utf8_encoding.py
+pygraphviz/__init__.py
+pygraphviz/agraph.py
+pygraphviz/graphviz.i
+pygraphviz/graphviz.py
+pygraphviz/graphviz_wrap.c
+pygraphviz/release.py
+pygraphviz/version.py
+pygraphviz.egg-info/PKG-INFO
+pygraphviz.egg-info/SOURCES.txt
+pygraphviz.egg-info/dependency_links.txt
+pygraphviz.egg-info/top_level.txt
+pygraphviz/tests/__init__.py
+pygraphviz/tests/test.py
+pygraphviz/tests/test_attribute_defaults.py
+pygraphviz/tests/test_attributes.py
+pygraphviz/tests/test_clear.py
+pygraphviz/tests/test_drawing.py
+pygraphviz/tests/test_edge_attributes.py
+pygraphviz/tests/test_graph.py
+pygraphviz/tests/test_html.py
+pygraphviz/tests/test_layout.py
+pygraphviz/tests/test_node_attributes.py
+pygraphviz/tests/test_readwrite.py
+pygraphviz/tests/test_string.py
+pygraphviz/tests/test_subgraph.py
+pygraphviz/tests/test_unicode.py
\ No newline at end of file
diff --git a/pygraphviz.egg-info/dependency_links.txt b/pygraphviz.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/pygraphviz.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/pygraphviz.egg-info/top_level.txt b/pygraphviz.egg-info/top_level.txt
new file mode 100644
index 0000000..7d3252d
--- /dev/null
+++ b/pygraphviz.egg-info/top_level.txt
@@ -0,0 +1 @@
+pygraphviz
diff --git a/pygraphviz/__init__.py b/pygraphviz/__init__.py
index 8d136bb..159e5ed 100644
--- a/pygraphviz/__init__.py
+++ b/pygraphviz/__init__.py
@@ -55,14 +55,15 @@ __author__   = '%s <%s>\n%s <%s>\n%s <%s>' % \
                 release.authors['Renieris'] )
 __license__  = release.license
 
-from .agraph import AGraph, Node, Edge, Attribute, ItemAttribute
+from .agraph import AGraph, Node, Edge, Attribute, ItemAttribute, DotError
 
 __all__=[
     'AGraph',
     'Node',
     'Edge',
     'Attribute',
-    'ItemAttribute'
+    'ItemAttribute',
+    'DotError'
     ]
 
 
diff --git a/pygraphviz/agraph.py b/pygraphviz/agraph.py
index 368d81c..ef80569 100644
--- a/pygraphviz/agraph.py
+++ b/pygraphviz/agraph.py
@@ -58,6 +58,8 @@ class PipeReader(threading.Thread):
 class _Action(object):
     find, create = 0, 1
 
+class DotError(ValueError):
+    """Dot data parsing error"""
 
 class AGraph(object):
     """Class for Graphviz agraph type.
@@ -109,7 +111,7 @@ class AGraph(object):
       directed: True|False
 
       data: Dictionary of dictionaries or dictionary of lists
-      representing nodes or edges to load into intial graph
+      representing nodes or edges to load into initial graph
 
       string:  String containing a dot format graph
 
@@ -291,7 +293,7 @@ class AGraph(object):
         >>> G.nodes()  # doctest: +IGNORE_UNICODE
         [u'a', u'1']
 
-        Attributes can be added to nodes on creation
+        Attributes can be added to nodes on creation or updated after creation
         (attribute values must be strings)
 
         >>> G.add_node(2,color='red')
@@ -300,7 +302,6 @@ class AGraph(object):
         for a list of attributes.
 
         Anonymous Graphviz nodes are currently not implemented.
-
         """
         if not is_string_like(n):
             n = str(n)
@@ -309,8 +310,8 @@ class AGraph(object):
             nh = gv.agnode(self.handle, n, _Action.find)
         except KeyError:
             nh = gv.agnode(self.handle, n, _Action.create)
-            node = Node(self, nh=nh)
-            node.attr.update(**attr)
+        node = Node(self, nh=nh)
+        node.attr.update(**attr)
 
     def add_nodes_from(self, nbunch, **attr):
         """Add nodes from a container nbunch.
@@ -324,10 +325,9 @@ class AGraph(object):
         [u'1', u'a', u'b', u'spam']
 
 
-        Attributes can be added to nodes on creation
+        Attributes can be added to nodes on creation or updated after creation
 
         >>> G.add_nodes_from(nlist, color='red') # set all nodes in nlist red
-
         """
         for n in nbunch:
             self.add_node(n, **attr)
@@ -341,7 +341,6 @@ class AGraph(object):
         >>> G=AGraph()
         >>> G.add_node('a')
         >>> G.remove_node('a')
-
         """
         if not is_string_like(n):
             n = str(n)
@@ -448,7 +447,7 @@ class AGraph(object):
         >>> sorted(G.edges(keys=True))  # doctest: +IGNORE_UNICODE
         [(u'a', u'b', u'first'), (u'a', u'b', u'second')]
 
-        Attributes can be added when edges are created
+        Attributes can be added when edges are created or updated after creation
 
         >>> G.add_edge('a','b',color='green')
 
@@ -470,16 +469,18 @@ class AGraph(object):
         except:
             self.add_node(v)
             vh = Node(self, v).handle
+        if key is not None:
+            if not is_string_like(key):
+                key = str(key)
+            key = key.encode(self.encoding)
         try:
-            if key is not None:
-                if not is_string_like(key):
-                    key = str(key)
-                key = key.encode(self.encoding)
+            # new
             eh = gv.agedge(self.handle, uh, vh, key, _Action.create)
-            e = Edge(self, eh=eh)
-            e.attr.update(**attr)
         except KeyError:
-            return None # silent failure for strict graph, already added
+            # for strict graph, or already added
+            eh = gv.agedge(self.handle, uh, vh, key, _Action.find)
+        e = Edge(self, eh=eh)
+        e.attr.update(**attr)
 
     def add_edges_from(self, ebunch, **attr):
         """Add nodes to graph from a container ebunch.
@@ -490,10 +491,9 @@ class AGraph(object):
         >>> elist=[('a','b'),('b','c')]
         >>> G.add_edges_from(elist)
 
-        Attributes can be added when edges are created
+        Attributes can be added when edges are created or updated after creation
 
         >>> G.add_edges_from(elist, color='green')
-
         """
         for e in ebunch:
             self.add_edge(e, **attr)
@@ -948,9 +948,8 @@ class AGraph(object):
 
     def clear(self):
         """Remove all nodes, edges, and attributes from the graph."""
-        self.edge_attr.clear()
-        self.node_attr.clear()
-        self.graph_attr.clear()
+        self.remove_edges_from(self.edges())
+        self.remove_nodes_from(self.nodes())
         # now "close" existing graph and create a new graph
         name = gv.agnameof(self.handle)
         strict = self.strict
@@ -1023,10 +1022,13 @@ class AGraph(object):
         if nbunch is None: return H
         # add induced subgraph on nodes in nbunch
         bunch = self.prepare_nbunch(nbunch)
-        H.add_nodes_from(bunch)
-        for (u, v) in self.edges():
+        for n in bunch:
+            node = Node(self, n)
+            nh = gv.agsubnode(handle, node.handle, _Action.create)
+        for (u, v, k) in self.edges(keys=True):
             if u in H and v in H:
-                H.add_edge(u, v)
+                edge = Edge(self, u, v, k)
+                eh = gv.agsubedge(handle, edge.handle, _Action.create)
 
         return H
 
@@ -1195,7 +1197,11 @@ class AGraph(object):
         try:
             if self.handle is not None:
                 gv.agclose(self.handle)
-            self.handle = gv.agread(fh, None)
+            try:
+                self.handle = gv.agread(fh, None)
+            except ValueError:
+                raise DotError
+            
         except IOError:
             print("IO error reading file")
 
@@ -1816,7 +1822,6 @@ class ItemAttribute(Attribute):
             except KeyError: # gv.agxget returned KeyError, skip
                 continue
 
-
 def _test_suite():
     import doctest
 
diff --git a/pygraphviz/graphviz.i b/pygraphviz/graphviz.i
new file mode 100644
index 0000000..0d9b43b
--- /dev/null
+++ b/pygraphviz/graphviz.i
@@ -0,0 +1,302 @@
+#    Copyright (C) 2004-2006 by 
+#    Aric Hagberg <hagberg at lanl.gov>
+#    Dan Schult <dschult at colgate.edu>
+#    Manos Renieris, http://www.cs.brown.edu/~er/
+#    Distributed with BSD license.     
+#    All rights reserved, see LICENSE for details.
+
+%module graphviz
+
+%{
+#include "graphviz/cgraph.h"
+%}
+
+%{
+#if PY_VERSION_HEX >= 0x03000000
+extern PyTypeObject PyIOBase_Type;
+#endif
+%}
+
+%typemap(in) FILE* (int fd, PyObject *mode_obj, PyObject *mode_byte_obj, char *mode) {
+%#if PY_VERSION_HEX >= 0x03000000
+    if (!PyObject_IsInstance($input, (PyObject *)&PyIOBase_Type)) {
+        PyErr_SetString(PyExc_TypeError, "not a file handle");
+        return NULL;
+    }
+    // work around to get hold of FILE*
+    fd = PyObject_AsFileDescriptor($input);
+    mode_obj = PyObject_GetAttrString($input, "mode");
+    mode_byte_obj = PyUnicode_AsUTF8String(mode_obj);
+    mode = PyBytes_AsString(mode_byte_obj);
+    $1 = fdopen(fd, mode);
+    Py_XDECREF(mode_obj);
+    Py_XDECREF(mode_byte_obj);
+%#else
+    if (!PyFile_Check($input)) {
+        PyErr_SetString(PyExc_TypeError, "not a file handle");
+        return NULL;
+    }
+    $1 = PyFile_AsFile($input);
+%#endif
+}
+
+
+%exception agnode {
+  $action
+  if (!result) {
+     PyErr_SetString(PyExc_KeyError,"agnode: no key");
+     return NULL;
+  }
+}
+
+%exception agedge {
+  $action
+  if (!result) {
+     PyErr_SetString(PyExc_KeyError,"agedge: no key");
+     return NULL;
+  }
+}
+
+/* agset returns -1 on error */
+%exception agset {
+  $action
+  if (result==-1) {
+     PyErr_SetString(PyExc_KeyError,"agset: no key");
+     return NULL;
+  }
+} 
+
+/* agsetsafeset_label returns -1 on error */
+%exception agsafeset_label {
+  $action
+  if (result==-1) {
+     PyErr_SetString(PyExc_KeyError,"agsafeset_label: Error");
+     return NULL;
+  }
+} 
+
+
+/* agdelnode returns -1 on error */
+%exception agdelnode {
+  $action
+  if (result==-1) {
+     PyErr_SetString(PyExc_KeyError,"agdelnode: no key");
+     return NULL;
... 1136 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pygraphviz.git



More information about the Python-modules-commits mailing list