[Python-modules-commits] [pydot] 07/14: Import pydot_1.2.3.orig.tar.gz

Sandro Tosi morph at moszumanska.debian.org
Sat Nov 25 19:47:22 UTC 2017


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

morph pushed a commit to branch master
in repository pydot.

commit e636b23254ad7c2654c268a535fe36e10f2ad99e
Author: Sandro Tosi <morph at debian.org>
Date:   Sat Nov 25 13:03:08 2017 -0500

    Import pydot_1.2.3.orig.tar.gz
---
 .gitattributes                                     |    9 +
 .gitignore                                         |   23 +
 .travis.yml                                        |   24 +
 ChangeLog                                          |  134 ++
 LICENSE                                            |    4 +-
 MANIFEST.in                                        |    5 +
 PKG-INFO                                           |   36 -
 README                                             |   29 -
 README.md                                          |   59 +
 dot_parser.py                                      |  370 ++---
 pydot.py                                           | 1599 +++++++++----------
 requirements.txt                                   |    4 +
 setup.py                                           |   46 +-
 test/from-past-to-future/AI.png                    |  Bin 0 -> 3998 bytes
 test/from-past-to-future/Agents.png                |  Bin 0 -> 8305 bytes
 test/from-past-to-future/Automata.png              |  Bin 0 -> 5007 bytes
 test/from-past-to-future/Berners_Lee.png           |  Bin 0 -> 8899 bytes
 test/from-past-to-future/Biology.png               |  Bin 0 -> 11775 bytes
 test/from-past-to-future/Chaos.png                 |  Bin 0 -> 4830 bytes
 test/from-past-to-future/Computers.png             |  Bin 0 -> 10328 bytes
 test/from-past-to-future/Cryptography.png          |  Bin 0 -> 19732 bytes
 test/from-past-to-future/Dertouzos.png             |  Bin 0 -> 5729 bytes
 test/from-past-to-future/Ontology.png              |  Bin 0 -> 7796 bytes
 test/from-past-to-future/Rejewski.png              |  Bin 0 -> 6493 bytes
 test/from-past-to-future/Search_Engines.png        |  Bin 0 -> 5832 bytes
 test/from-past-to-future/Semantic_Web.png          |  Bin 0 -> 2995 bytes
 test/from-past-to-future/Small_World.png           |  Bin 0 -> 3370 bytes
 test/from-past-to-future/Social_Networks.png       |  Bin 0 -> 7481 bytes
 test/from-past-to-future/Turing.png                |  Bin 0 -> 10235 bytes
 test/from-past-to-future/XML.png                   |  Bin 0 -> 3905 bytes
 test/from-past-to-future/from-past-to-future.dot   |  108 ++
 test/graphs/ER.dot                                 |   22 +
 test/graphs/Heawood.dot                            |   31 +
 test/graphs/KW91.dot                               |   20 +
 test/graphs/Latin1.dot                             |    5 +
 test/graphs/NaN.dot                                |  126 ++
 test/graphs/Petersen.dot                           |   48 +
 test/graphs/a.dot                                  |    4 +
 test/graphs/abstract.dot                           |   71 +
 test/graphs/alf.dot                                |   32 +
 test/graphs/arrows.dot                             |   57 +
 test/graphs/arrowsize.dot                          |   56 +
 test/graphs/awilliams.dot                          |  188 +++
 test/graphs/b.dot                                  |   13 +
 test/graphs/b102.dot                               |  916 +++++++++++
 test/graphs/b106.dot                               |  337 ++++
 test/graphs/b117.dot                               |   13 +
 test/graphs/b123.dot                               |    4 +
 test/graphs/b124.dot                               |  366 +++++
 test/graphs/b135.dot                               |    8 +
 test/graphs/b143.dot                               |  504 ++++++
 test/graphs/b145.dot                               |   10 +
 test/graphs/b146.dot                               |    5 +
 test/graphs/b15.dot_crashes_dot_bus_error          |  235 +++
 test/graphs/b155.dot                               |   27 +
 test/graphs/b22.dot                                |   24 +
 test/graphs/b29.dot                                |  499 ++++++
 test/graphs/b3.dot                                 |   43 +
 test/graphs/b33.dot                                |    9 +
 test/graphs/b34.dot                                |   20 +
 test/graphs/b36.dot                                |  309 ++++
 test/graphs/b491.dot                               |    9 +
 test/graphs/b51.dot                                |  213 +++
 test/graphs/b53.dot                                |   84 +
 test/graphs/b545.dot                               |    9 +
 test/graphs/b56.dot                                |   65 +
 test/graphs/b57.dot                                |  111 ++
 test/graphs/b58.dot_crashes_dot_abort_trap         |   14 +
 test/graphs/b60.dot                                |    5 +
 test/graphs/b62.dot                                |   10 +
 test/graphs/b68.dot                                |   29 +
 test/graphs/b69.dot                                | 1586 +++++++++++++++++++
 test/graphs/b7.dot                                 |   15 +
 test/graphs/b71.dot                                |  125 ++
 test/graphs/b73.dot                                |    5 +
 test/graphs/b73a.dot                               |    5 +
 test/graphs/b76.dot                                |    5 +
 test/graphs/b77.dot                                |    6 +
 test/graphs/b786.dot                               |   26 +
 test/graphs/b79.dot                                |    5 +
 test/graphs/b80.dot                                |    7 +
 test/graphs/b80a.dot                               |    6 +
 test/graphs/b85.dot                                |    8 +
 test/graphs/b94.dot                                |  511 ++++++
 test/graphs/b993.dot                               |   10 +
 test/graphs/bad.dot                                |    6 +
 test/graphs/badvoro.dot                            | 1619 ++++++++++++++++++++
 test/graphs/big.dot                                |  269 ++++
 test/graphs/biglabel.dot                           |   92 ++
 test/graphs/cairo.dot                              |   94 ++
 test/graphs/center.dot                             |    4 +
 test/graphs/clover.dot                             |    5 +
 test/graphs/clust.dot                              |   22 +
 test/graphs/clust1.dot                             |    8 +
 test/graphs/clust2.dot                             |    8 +
 test/graphs/clust3.dot                             |    8 +
 test/graphs/clust4.dot                             |   27 +
 test/graphs/clust5.dot                             |   25 +
 test/graphs/color.dot                              |   10 +
 test/graphs/colors.dot                             |   13 +
 test/graphs/colorscheme.dot                        |   19 +
 test/graphs/compound.dot                           |   18 +
 test/graphs/crazy.dot                              |  104 ++
 test/graphs/ctext.dot                              |   17 +
 test/graphs/d.dot                                  |   13 +
 test/graphs/dd.dot                                 |   23 +
 test/graphs/decorate.dot                           |   57 +
 test/graphs/dfa.dot                                |   34 +
 test/graphs/dfd.ps                                 |   31 +
 test/graphs/dir.dot                                |    8 +
 test/graphs/dpd.dot                                |  110 ++
 test/graphs/edgeclip.dot                           |    6 +
 test/graphs/fig6.dot                               |   74 +
 test/graphs/fsm.dot                                |   20 +
 test/graphs/grammar.dot                            |   71 +
 test/graphs/hashtable.dot                          |   23 +
 test/graphs/honda-tokoro.dot                       |   76 +
 test/graphs/html.dot                               |   29 +
 test/graphs/html2.dot                              |   46 +
 test/graphs/in.dot                                 |    6 +
 test/graphs/jcctree.dot                            |   44 +
 test/graphs/jsort.dot                              |  150 ++
 test/graphs/labelclust-fbc.dot                     |   18 +
 test/graphs/labelclust-fbd.dot                     |   17 +
 test/graphs/labelclust-fbl.dot                     |   18 +
 test/graphs/labelclust-fbr.dot                     |   18 +
 test/graphs/labelclust-fdc.dot                     |   17 +
 test/graphs/labelclust-fdd.dot                     |   16 +
 test/graphs/labelclust-fdl.dot                     |   17 +
 test/graphs/labelclust-fdr.dot                     |   17 +
 test/graphs/labelclust-ftc.dot                     |   18 +
 test/graphs/labelclust-ftd.dot                     |   17 +
 test/graphs/labelclust-ftl.dot                     |   18 +
 test/graphs/labelclust-ftr.dot                     |   18 +
 test/graphs/labelclust-nbc.dot                     |   17 +
 test/graphs/labelclust-nbd.dot                     |   16 +
 test/graphs/labelclust-nbl.dot                     |   17 +
 test/graphs/labelclust-nbr.dot                     |   17 +
 test/graphs/labelclust-ndc.dot                     |   16 +
 test/graphs/labelclust-ndd.dot                     |   15 +
 test/graphs/labelclust-ndl.dot                     |   16 +
 test/graphs/labelclust-ndr.dot                     |   16 +
 test/graphs/labelclust-ntc.dot                     |   17 +
 test/graphs/labelclust-ntd.dot                     |   16 +
 test/graphs/labelclust-ntl.dot                     |   17 +
 test/graphs/labelclust-ntr.dot                     |   17 +
 test/graphs/labelroot-fbc.dot                      |   20 +
 test/graphs/labelroot-fbd.dot                      |   19 +
 test/graphs/labelroot-fbl.dot                      |   20 +
 test/graphs/labelroot-fbr.dot                      |   20 +
 test/graphs/labelroot-fdc.dot                      |   19 +
 test/graphs/labelroot-fdd.dot                      |   18 +
 test/graphs/labelroot-fdl.dot                      |   19 +
 test/graphs/labelroot-fdr.dot                      |   19 +
 test/graphs/labelroot-ftc.dot                      |   20 +
 test/graphs/labelroot-ftd.dot                      |   19 +
 test/graphs/labelroot-ftl.dot                      |   20 +
 test/graphs/labelroot-ftr.dot                      |   20 +
 test/graphs/labelroot-nbc.dot                      |   19 +
 test/graphs/labelroot-nbd.dot                      |   18 +
 test/graphs/labelroot-nbl.dot                      |   19 +
 test/graphs/labelroot-nbr.dot                      |   19 +
 test/graphs/labelroot-ndc.dot                      |   18 +
 test/graphs/labelroot-ndd.dot                      |   17 +
 test/graphs/labelroot-ndl.dot                      |   18 +
 test/graphs/labelroot-ndr.dot                      |   18 +
 test/graphs/labelroot-ntc.dot                      |   19 +
 test/graphs/labelroot-ntd.dot                      |   18 +
 test/graphs/labelroot-ntl.dot                      |   19 +
 test/graphs/labelroot-ntr.dot                      |   19 +
 test/graphs/layer.dot                              |   11 +
 test/graphs/layer2.dot                             |   12 +
 test/graphs/layers.dot                             |    9 +
 test/graphs/ldbxtried.dot                          |  416 +++++
 test/graphs/longflat.dot                           |    7 +
 test/graphs/lsunix1.dot                            |   55 +
 test/graphs/lsunix2.dot                            |   55 +
 test/graphs/lsunix3.dot                            |   55 +
 test/graphs/md5_dot.jpe_text                       |  185 +++
 test/graphs/md5_orig.jpe_text                      |  197 +++
 test/graphs/mike.dot                               |   42 +
 test/graphs/mode.dot                               |  374 +++++
 test/graphs/multi.dot                              |   10 +
 test/graphs/newarrows.dot                          |   57 +
 test/graphs/ngk10_4.dot                            |  102 ++
 test/graphs/nhg.dot                                |   13 +
 test/graphs/nojustify.dot                          |    9 +
 test/graphs/ordering.dot                           |   18 +
 test/graphs/overlap.dot                            |  110 ++
 test/graphs/p.dot                                  |   16 +
 test/graphs/p2.dot                                 |   16 +
 test/graphs/p3.dot                                 |   16 +
 test/graphs/p4.dot                                 |   17 +
 test/graphs/pack.dot                               |    9 +
 test/graphs/pgram.dot                              |   91 ++
 test/graphs/pm2way.dot                             |  126 ++
 test/graphs/pmpipe.dot                             |  219 +++
 test/graphs/polypoly.dot                           |  198 +++
 test/graphs/ports.dot                              |   27 +
 test/graphs/proc3d.dot                             |  443 ++++++
 test/graphs/process.dot                            |   15 +
 test/graphs/ps.dot                                 |    4 +
 test/graphs/ps_user_shapes.dot                     |    3 +
 test/graphs/pslib.dot                              |   78 +
 .../pydot_children_wrong_order_clustlabel.dot      |    6 +
 test/graphs/pydot_children_wrong_order_style.dot   |   36 +
 test/graphs/record.dot                             |   32 +
 test/graphs/record2.dot                            |    6 +
 test/graphs/records.dot                            |   17 +
 test/graphs/rootlabel.dot                          |   17 +
 test/graphs/rowcolsep.dot                          |    8 +
 test/graphs/rowe.dot                               |   72 +
 test/graphs/russian.dot                            |    9 +
 test/graphs/shapes.dot                             |   39 +
 test/graphs/shells.dot                             |   55 +
 test/graphs/size.dot                               |   62 +
 test/graphs/states.dot                             |   21 +
 test/graphs/structs.dot                            |    9 +
 test/graphs/train11.dot                            |   30 +
 test/graphs/trapeziumlr.dot                        |   79 +
 test/graphs/tree.dot                               |   20 +
 test/graphs/triedds.dot                            |  114 ++
 test/graphs/try.dot                                |   15 +
 test/graphs/unix.dot                               |   53 +
 test/graphs/unix2.dot                              |   63 +
 test/graphs/unix2k.dot                             |   63 +
 test/graphs/url.dot                                |   41 +
 test/graphs/user_shapes.dot                        |    5 +
 test/graphs/viewfile.dot                           |   64 +
 test/graphs/viewport.dot                           |  486 ++++++
 test/graphs/weight.dot                             |   62 +
 test/graphs/world.dot                              |   67 +
 test/graphs/xx.dot                                 |  916 +++++++++++
 test/my_tests/escaped_newlines.dot                 |    8 +
 test/my_tests/escaped_quoted_label.dot             |    3 +
 test/my_tests/html_labels.dot                      |    8 +
 test/my_tests/numeric_ids_unicode.dot              |    6 +
 test/my_tests/parsing_test.dot                     |   47 +
 test/pydot_unittest.py                             |  349 +++++
 239 files changed, 18141 insertions(+), 1132 deletions(-)

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..a449940
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,9 @@
+*.py eol=lf
+*.dot eol=lf
+*.txt eol=lf
+*.md eol=lf
+*.yml eol=lf
+
+*.png binary
+*.ps binary
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e877501
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,23 @@
+.coverage
+todo.txt
+.DS_Store
+._.DS_Store
+*.out
+*parsetab.py
+*.c
+__pycache__
+*.pyc
+*.whl
+*.pdf
+*.png
+*.svg
+*.txt
+*.p
+*.so
+*.html
+*.tar.gz
+dist/*
+build/*
+*.egg-info
+*.swp
+
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..a19f732
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,24 @@
+language: python
+
+python:
+  - "2.6"
+  - "2.7"
+  - "3.5"
+
+addons:
+  apt:
+    packages:
+      - graphviz
+
+install:
+  - pip install -U pip setuptools
+  - python setup.py sdist
+  - pip install dist/pydot-*.tar.gz
+  - pip install -r requirements.txt
+
+script:
+  - cd test/
+  - python pydot_unittest.py
+
+# after_success:
+#   - coveralls
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..4be5019
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,134 @@
+# `pydot` changelog
+
+
+## 1.2.3 (2016-10-06)
+
+- support Python 2.6
+- several corrections
+- quote empty strings to avoid graphviz errors
+
+
+## 1.2.0 (2016-07-01)
+
+- support Python 3
+- bumped dependency to `pyparsing >= 2.1.4`
+- tests running on Travis CI
+- tests require `chardet`
+- detect character encoding for most test files
+  using the package `chardet`
+
+API:
+
+- on all operating systems, search GraphViz
+  executables in environment `$PATH`,
+  using `subprocess.Popen`.
+  No paths hard-coded due to security and privacy issues.
+
+- add option to pass GraphViz executable name
+  or absolute path as `prog` to `pydot.Dot.write_*` methods.
+  This provides an alternative to
+  adding GraphViz to the `$PATH`.
+
+- the functions:
+    - `pydot.graph_from_dot_data`
+    - `pydot.graph_from_dot_file`
+    - `dot_parser.parse_dot_data`
+  changed to always return a `list` of graphs,
+  instead of behaving differently for singletons.
+
+- require that the user explicitly give an encoding to
+  the function `pydot.graph_from_dot_file`,
+  with default encoding same as `io.open`.
+
+- decode to unicode at program boundaries, and
+  treat binary images as bytes,
+  for more compatibility with python 3.
+  Use `io.open`, instead of the built-in `open`.
+
+- rm function `pydot.set_graphviz_executables`
+
+- rm attribute `pydot.Dot.progs`
+
+
+## 1.1.0 (2016-05-23)
+
+- compatibility with `pyparsing >= 1.5.7`
+
+API:
+
+- `pydot.Graph.to_string`: hide `subgraph` keyword only if so requested
+- produce `warnings.warn` if `pydot.dot_parser` fails to import,
+  instead of `print`
+
+
+## 1.0.29 (2016-05-16)
+
+- Maintenance release that keeps the same API
+- pin `pyparsing == 1.5.7`
+- update version number in source code
+- update `setup.py`
+
+
+2004-04-28 21:50  carrer
+
+	* pydot.py: Some of the changes already made should allow pydot to
+	  run on OSX.  Bumped version to 0.9.2
+
+2004-04-24 17:52  carrer
+
+	* setup.py: Added more metainformation to the distribution.
+
+2004-04-24 17:51  carrer
+
+	* pydot.py: Added support for circo and fdp. Fixed piping mechanism
+	  to not to capture stderr.
+
+2004-04-24 13:26  carrer
+
+	* ChangeLog, LICENSE, MANIFEST, README, setup.py: Adding
+	  suplementary files to the distribution to the CVS.
+
+2004-04-24 12:57  carrer
+
+	* pydot.py: Bumped version to 0.9.1
+
+2004-04-24 01:36  carrer
+
+	* pydot.py: Implemented tweaks suggested by John B. Cole to handle
+	  non-str nodes, converting them to strings.
+
+2004-04-24 01:10  carrer
+
+	* pydot.py: Applied patch for Windows support by Kent Johnson.
+
+2004-04-24 01:05  carrer
+
+	* pydot.py: Fixed to properly handle unicode strings in attributes.
+
+2004-04-20 00:06  carrer
+
+	* pydot.py:
+	  Fixed silly error in graph_from_edges. When pasting the function
+	  into the code, the references to the pydot module were not
+	  removed, which are no longer needed since we now are _in_ the
+	  module.
+
+2004-04-19 23:33  carrer
+
+	* pydot.py:
+	  Added support to write files with the desired output format with
+	  write_[format]
+
+2004-04-19 22:53  carrer
+
+	* pydot.py:
+	  Done some clean up, no major changes.
+
+2004-04-08 00:22  carrer
+
+	* pydot.py:
+	  Initial revision.
+
+2004-04-08 00:22  carrer
+
+	* pydot.py: Initial revision
diff --git a/LICENSE b/LICENSE
index 3291fa1..998bded 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,3 +1,5 @@
+Copyright (c) 2014 Carlos Jenkins
+Copyright (c) 2014 Lance Helper
 Copyright (c) 2004 Ero Carrera
 
 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
@@ -13,4 +15,4 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
 LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..5befd86
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,5 @@
+include README.md
+include LICENSE
+include ChangeLog
+include requirements.txt
+
diff --git a/PKG-INFO b/PKG-INFO
deleted file mode 100644
index 6b6d30e..0000000
--- a/PKG-INFO
+++ /dev/null
@@ -1,36 +0,0 @@
-Metadata-Version: 1.0
-Name: pydot
-Version: 1.0.28
-Summary: Python interface to Graphviz's Dot
-Home-page: http://code.google.com/p/pydot/
-Author: Ero Carrera
-Author-email: ero at dkbza.org
-License: MIT
-Download-URL: http://pydot.googlecode.com/files/pydot-1.0.28.tar.gz
-Description: Graphviz's dot language Python interface.
-        
-        This module provides with a full interface to create handle modify
-        and process graphs in Graphviz's dot language.
-        
-        References:
-        
-        pydot Homepage: http://code.google.com/p/pydot/
-        Graphviz:       http://www.graphviz.org/
-        DOT Language:   http://www.graphviz.org/doc/info/lang.html
-        
-        Programmed and tested with Graphviz 2.26.3 and Python 2.6 on OSX 10.6.4
-        
-        Copyright (c) 2005-2011 Ero Carrera <ero.carrera at gmail.com>
-        
-        Distributed under MIT license [http://opensource.org/licenses/mit-license.html].
-        
-Keywords: graphviz dot graphs visualization
-Platform: any
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Science/Research
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Natural Language :: English
-Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python
-Classifier: Topic :: Scientific/Engineering :: Visualization
-Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff --git a/README b/README
deleted file mode 100644
index e255e36..0000000
--- a/README
+++ /dev/null
@@ -1,29 +0,0 @@
-pydot - Python interface to Graphviz's Dot language
-Ero Carrera (c) 2004-2007
-ero at dkbza.org
-
-This code is distributed under the MIT license.
-
-Requirements:
--------------
-
-pyparsing: pydot requires the pyparsing module in order to be
-	able to load DOT files.
-
-GraphViz:  is needed in order to render the graphs into any of
-	the plethora of output formats supported.
-
-Installation:
--------------
-
-Should suffice with doing:
-
- python setup.py install
-
-Needless to say, no installation is needed just to use the module. A mere:
-
- import pydot
-
-should do it, provided that the directory containing the modules is on Python
-module search path.
-
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..22b6903
--- /dev/null
+++ b/README.md
@@ -0,0 +1,59 @@
+[![Build Status][build_img]][travis]
+
+
+About
+=====
+
+`pydot`:
+
+  - is an interface to [Graphviz][1]
+  - can parse and dump into the [DOT language][2] used by GraphViz,
+  - is written in pure Python,
+
+and [`networkx`][3] can convert its graphs to `pydot`.
+Development occurs at [github][11] (under branch `dev`),
+where you can report issues and contribute code.
+
+
+Installation
+============
+
+From [PyPI][4] using [`pip`][5]:
+
+`pip install pydot`
+
+From source:
+
+`python setup.py install`
+
+
+Dependencies
+============
+
+- [`pyparsing`][6]: used only for *loading* DOT files,
+  installed automatically during `pydot` installation.
+
+- GraphViz: used to render graphs as PDF, PNG, SVG, etc.
+  Should be installed separately, using your system's
+  [package manager][7], something similar (e.g., [MacPorts][8]),
+  or from [its source][9].
+
+
+License
+=======
+
+Distributed under an [MIT license][10].
+
+[1]: http://www.graphviz.org
+[2]: https://en.wikipedia.org/wiki/DOT_%28graph_description_language%29
+[3]: https://github.com/networkx/networkx
+[4]: https://pypi.python.org/pypi
+[5]: https://github.com/pypa/pip
+[6]: http://pyparsing.wikispaces.com/
+[7]: https://en.wikipedia.org/wiki/Package_manager
+[8]: https://www.macports.org
+[9]: https://github.com/ellson/graphviz
+[10]: https://github.com/erocarrera/pydot/blob/master/LICENSE
+[11]: https://github.com/erocarrera/pydot
+[build_img]: https://travis-ci.org/erocarrera/pydot.svg?branch=master
+[travis]: https://travis-ci.org/erocarrera/pydot
diff --git a/dot_parser.py b/dot_parser.py
index dedd61a..ebf2c13 100644
--- a/dot_parser.py
+++ b/dot_parser.py
@@ -1,40 +1,46 @@
-# -*- coding: Latin-1 -*-
 """Graphviz's dot language parser.
 
-The dotparser parses graphviz files in dot and dot files and transforms them
+The dotparser parses graphviz files in
+dot and dot files and transforms them
 into a class representation defined by pydot.
 
-The module needs pyparsing (tested with version 1.2.2) and pydot
-
 Author: Michael Krause <michael at krause-software.de>
 Fixes by: Ero Carrera <ero at dkbza.org>
 """
+from __future__ import division
+from __future__ import print_function
+import sys
 
-__author__ = ['Michael Krause', 'Ero Carrera']
-__license__ = 'MIT'
-
+from pyparsing import (
+    nestedExpr, Literal, CaselessLiteral,
+    Word, OneOrMore,
+    Forward,
+    Group, Optional, Combine,
+    restOfLine, cStyleComment, nums, alphanums,
+    printables,
+    ParseException, ParseResults, CharsNotIn,
+    QuotedString)
 
-import sys
-import glob
 import pydot
-import re
-import codecs
 
-from pyparsing import __version__ as pyparsing_version
+__author__ = ['Michael Krause', 'Ero Carrera']
+__license__ = 'MIT'
+
 
-from pyparsing import ( nestedExpr, Literal, CaselessLiteral, Word, Upcase, OneOrMore, ZeroOrMore,
-    Forward, NotAny, delimitedList, oneOf, Group, Optional, Combine, alphas, nums,
-    restOfLine, cStyleComment, nums, alphanums, printables, empty, quotedString,
-    ParseException, ParseResults, CharsNotIn, _noncomma, dblQuotedString, QuotedString, ParserElement )
+PY3 = sys.version_info >= (3, 0, 0)
+if PY3:
+    str_type = str
+else:
+    str_type = basestring
 
 
-class P_AttrList:
+class P_AttrList(object):
 
     def __init__(self, toks):
 
         self.attrs = {}
         i = 0
-        
+
         while i < len(toks):
             attrname = toks[i]
             if i+2 < len(toks) and toks[i+1] == '=':
@@ -43,10 +49,10 @@ class P_AttrList:
             else:
                 attrvalue = None
                 i += 1
-                
+
             self.attrs[attrname] = attrvalue
-            
-            
+
+
     def __repr__(self):
 
         return "%s(%r)" % (self.__class__.__name__, self.attrs)
@@ -72,54 +78,56 @@ def push_top_graph_stmt(str, loc, toks):
 
     attrs = {}
     g = None
-    
+
     for element in toks:
-    
-        if( isinstance(element, (ParseResults, tuple, list)) and
-            len(element) == 1 and isinstance(element[0], basestring) ):
-            
+
+        if (isinstance(element, (ParseResults, tuple, list)) and
+                len(element) == 1 and
+                isinstance(element[0], str_type)):
+
             element = element[0]
-            
+
         if element == 'strict':
             attrs['strict'] = True
-            
+
         elif element in ['graph', 'digraph']:
 
             attrs = {}
-            
+
             g = pydot.Dot(graph_type=element, **attrs)
             attrs['type'] = element
-            
+
             top_graphs.append( g )
-            
-        elif isinstance( element, basestring):
+
+        elif isinstance( element, str_type):
             g.set_name( element )
-            
+
         elif isinstance(element, pydot.Subgraph):
-        
+
             g.obj_dict['attributes'].update( element.obj_dict['attributes'] )
             g.obj_dict['edges'].update( element.obj_dict['edges'] )
             g.obj_dict['nodes'].update( element.obj_dict['nodes'] )
             g.obj_dict['subgraphs'].update( element.obj_dict['subgraphs'] )
-            
+
             g.set_parent_graph(g)
-            
+
         elif isinstance(element, P_AttrList):
             attrs.update(element.attrs)
 
         elif isinstance(element, (ParseResults, list)):
             add_elements(g, element)
-            
+
         else:
-            raise ValueError, "Unknown element statement: %r " % element
-    
-    
+            raise ValueError(
+                'Unknown element statement: {s}'.format(s=element))
+
+
     for g in top_graphs:
         update_parent_graph_hierarchy(g)
-    
+
     if len( top_graphs ) == 1:
         return top_graphs[0]
-        
+
     return top_graphs
 
 
@@ -128,20 +136,21 @@ def update_parent_graph_hierarchy(g, parent_graph=None, level=0):
 
     if parent_graph is None:
         parent_graph = g
-        
+
     for key_name in ('edges',):
 
         if isinstance(g, pydot.frozendict):
             item_dict = g
         else:
             item_dict = g.obj_dict
-            
-        if not item_dict.has_key( key_name ):
+
+        if key_name not in item_dict:
             continue
 
         for key, objs in item_dict[key_name].items():
             for obj in objs:
-                if 'parent_graph' in obj and obj['parent_graph'].get_parent_graph()==g:
+                if ('parent_graph' in obj and
+                        obj['parent_graph'].get_parent_graph()==g):
                     if obj['parent_graph'] is g:
                         pass
                     else:
@@ -149,13 +158,16 @@ def update_parent_graph_hierarchy(g, parent_graph=None, level=0):
 
                 if key_name == 'edges' and len(key) == 2:
                     for idx, vertex in enumerate( obj['points'] ):
-                        if isinstance( vertex, (pydot.Graph, pydot.Subgraph, pydot.Cluster)):
+                        if isinstance( vertex,
+                                      (pydot.Graph,
+                                       pydot.Subgraph, pydot.Cluster)):
                             vertex.set_parent_graph(parent_graph)
                         if isinstance( vertex, pydot.frozendict):
                             if vertex['parent_graph'] is g:
                                 pass
                             else:
-                                vertex['parent_graph'].set_parent_graph(parent_graph)
+                                vertex['parent_graph'].set_parent_graph(
+                                    parent_graph)
 
 
 
@@ -168,68 +180,73 @@ def add_defaults(element, defaults):
 
 
 
-def add_elements(g, toks, defaults_graph=None, defaults_node=None, defaults_edge=None):
-    
+def add_elements(g, toks, defaults_graph=None,
+                 defaults_node=None, defaults_edge=None):
+
     if defaults_graph is None:
         defaults_graph = {}
     if defaults_node is None:
         defaults_node = {}
     if defaults_edge is None:
         defaults_edge = {}
-        
+
     for elm_idx, element in enumerate(toks):
-        
+
         if isinstance(element, (pydot.Subgraph, pydot.Cluster)):
-        
+
             add_defaults(element, defaults_graph)
             g.add_subgraph(element)
-            
+
         elif isinstance(element, pydot.Node):
-        
+
             add_defaults(element, defaults_node)
             g.add_node(element)
-            
+
         elif isinstance(element, pydot.Edge):
-        
+
             add_defaults(element, defaults_edge)
             g.add_edge(element)
-            
+
         elif isinstance(element, ParseResults):
-        
+
             for e in element:
-                add_elements(g, [e], defaults_graph, defaults_node, defaults_edge)
-                
+                add_elements(g, [e], defaults_graph,
+                             defaults_node, defaults_edge)
+
         elif isinstance(element, DefaultStatement):
-        
+
             if element.default_type == 'graph':
-            
+
                 default_graph_attrs = pydot.Node('graph', **element.attrs)
                 g.add_node(default_graph_attrs)
 
             elif element.default_type == 'node':
-            
+
                 default_node_attrs = pydot.Node('node', **element.attrs)
                 g.add_node(default_node_attrs)
 
             elif element.default_type == 'edge':
-            
+
                 default_edge_attrs = pydot.Node('edge', **element.attrs)
                 g.add_node(default_edge_attrs)
                 defaults_edge.update(element.attrs)
 
             else:
-                raise ValueError, "Unknown DefaultStatement: %s " % element.default_type
-                
+                raise ValueError(
+                    'Unknown DefaultStatement: {s}'.format(
+                         s=element.default_type))
+
         elif isinstance(element, P_AttrList):
-        
+
             g.obj_dict['attributes'].update(element.attrs)
 
         else:
-            raise ValueError, "Unknown element statement: %r" % element
+            raise ValueError(
+                'Unknown element statement: {s}'.format(s=element))
+
 
+def push_graph_stmt(str, loc, toks):
 
-def push_graph_stmt(str, loc, toks):            
-                       
     g = pydot.Subgraph('')
     add_elements(g, toks)
     return g
@@ -267,7 +284,8 @@ def push_default_stmt(str, loc, toks):
     if default_type in ['graph', 'node', 'edge']:
         return DefaultStatement(default_type, attrs)
     else:
-        raise ValueError, "Unknown default statement: %r " % toks
+        raise ValueError(
+            'Unknown default statement: {s}'.format(s=toks))
 
 
 def push_attr_list(str, loc, toks):
@@ -283,10 +301,10 @@ def get_port(node):
             if len(node[1][0])==2:
                 if node[1][0][0]==':':
                     return node[1][0][1]
-                    
+
     return None
 
-    
+
 def do_node_ports(node):
 
     node_port = ''
@@ -295,9 +313,9 @@ def do_node_ports(node):
 
     return node_port
 
-    
+
 def push_edge_stmt(str, loc, toks):
-    
+
     tok_attrs = [a for a in toks if isinstance(a, P_AttrList)]
     attrs = {}
     for a in tok_attrs:
@@ -306,49 +324,53 @@ def push_edge_stmt(str, loc, toks):
     e = []
 
     if isinstance(toks[0][0], pydot.Graph):
-    
+
         n_prev = pydot.frozendict(toks[0][0].obj_dict)
-    else:        
+    else:
         n_prev = toks[0][0] + do_node_ports( toks[0] )
 
     if isinstance(toks[2][0], ParseResults):
-    
+
         n_next_list = [[n.get_name(),] for n in toks[2][0] ]
         for n_next in [n for n in n_next_list]:
             n_next_port = do_node_ports(n_next)
             e.append(pydot.Edge(n_prev, n_next[0]+n_next_port, **attrs))
 
     elif isinstance(toks[2][0], pydot.Graph):
-    
-        e.append(pydot.Edge(n_prev, pydot.frozendict(toks[2][0].obj_dict), **attrs))
+
+        e.append(pydot.Edge(n_prev,
+                            pydot.frozendict(toks[2][0].obj_dict),
+                            **attrs))
 
     elif isinstance(toks[2][0], pydot.Node):
-    
+
         node = toks[2][0]
... 21263 lines suppressed ...

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



More information about the Python-modules-commits mailing list