216 <a NAME="DistPackage.as_parent_of" ID="DistPackage.as_parent_of"></a> |
215 <a NAME="DistPackage.as_parent_of" ID="DistPackage.as_parent_of"></a> |
217 <h4>DistPackage.as_parent_of</h4> |
216 <h4>DistPackage.as_parent_of</h4> |
218 <b>as_parent_of</b>(<i>req</i>) |
217 <b>as_parent_of</b>(<i>req</i>) |
219 |
218 |
220 <p> |
219 <p> |
221 Return a DistPackage instance associated to a requirement |
220 Return a DistPackage instance associated to a requirement. This association is necessary for reversing the |
222 </p> |
221 PackageDAG. |
223 <p> |
222 </p> |
224 This association is necessary for reversing the PackageDAG. |
223 <p> |
225 </p> |
224 If `req` is None, and the `req` attribute of the current instance is also None, then the same instance will be |
226 <p> |
|
227 If `req` is None, and the `req` attribute of the current |
|
228 instance is also None, then the same instance will be |
|
229 returned. |
225 returned. |
230 </p> |
226 </p> |
231 <p> |
227 <p> |
232 :param ReqPackage req: the requirement to associate with |
228 :param ReqPackage req: the requirement to associate with |
233 :returns: DistPackage instance |
229 :returns: DistPackage instance |
234 </p> |
|
235 <p> |
|
236 |
|
237 </p> |
230 </p> |
238 <a NAME="DistPackage.as_requirement" ID="DistPackage.as_requirement"></a> |
231 <a NAME="DistPackage.as_requirement" ID="DistPackage.as_requirement"></a> |
239 <h4>DistPackage.as_requirement</h4> |
232 <h4>DistPackage.as_requirement</h4> |
240 <b>as_requirement</b>(<i></i>) |
233 <b>as_requirement</b>(<i></i>) |
241 |
234 |
430 <td><a href="#PackageDAG.filter">filter</a></td> |
411 <td><a href="#PackageDAG.filter">filter</a></td> |
431 <td>Filters nodes in a graph by given parameters</td> |
412 <td>Filters nodes in a graph by given parameters</td> |
432 </tr> |
413 </tr> |
433 <tr> |
414 <tr> |
434 <td><a href="#PackageDAG.get_children">get_children</a></td> |
415 <td><a href="#PackageDAG.get_children">get_children</a></td> |
435 <td>Get child nodes for a node by it's key</td> |
416 <td>Get child nodes for a node by its key</td> |
436 </tr> |
417 </tr> |
437 <tr> |
418 <tr> |
438 <td><a href="#PackageDAG.get_node_as_parent">get_node_as_parent</a></td> |
419 <td><a href="#PackageDAG.get_node_as_parent">get_node_as_parent</a></td> |
439 <td>Get the node from the keys of the dict representing the DAG.</td> |
420 <td>Get the node from the keys of the dict representing the DAG.</td> |
440 </tr> |
421 </tr> |
441 <tr> |
422 <tr> |
442 <td><a href="#PackageDAG.reverse">reverse</a></td> |
423 <td><a href="#PackageDAG.reverse">reverse</a></td> |
443 <td>Reverse the DAG, or turn it upside-down</td> |
424 <td>Reverse the DAG, or turn it upside-down.</td> |
444 </tr> |
425 </tr> |
445 <tr> |
426 <tr> |
446 <td><a href="#PackageDAG.sort">sort</a></td> |
427 <td><a href="#PackageDAG.sort">sort</a></td> |
447 <td>Return sorted tree in which the underlying _obj dict is an OrderedDict, sorted alphabetically by the keys</td> |
428 <td>Return sorted tree in which the underlying _obj dict is an dict, sorted alphabetically by the keys.</td> |
448 </tr> |
429 </tr> |
449 </table> |
430 </table> |
450 <h3>Static Methods</h3> |
431 <h3>Static Methods</h3> |
451 |
432 |
452 <table> |
433 <table> |
487 <a NAME="PackageDAG.filter" ID="PackageDAG.filter"></a> |
468 <a NAME="PackageDAG.filter" ID="PackageDAG.filter"></a> |
488 <h4>PackageDAG.filter</h4> |
469 <h4>PackageDAG.filter</h4> |
489 <b>filter</b>(<i>include, exclude</i>) |
470 <b>filter</b>(<i>include, exclude</i>) |
490 |
471 |
491 <p> |
472 <p> |
492 Filters nodes in a graph by given parameters |
473 Filters nodes in a graph by given parameters |
493 </p> |
474 </p> |
494 <p> |
475 <p> |
495 If a node is included, then all it's children are also |
476 If a node is included, then all it's children are also included. |
496 included. |
|
497 </p> |
477 </p> |
498 <p> |
478 <p> |
499 :param set include: set of node keys to include (or None) |
479 :param set include: set of node keys to include (or None) |
500 :param set exclude: set of node keys to exclude (or None) |
480 :param set exclude: set of node keys to exclude (or None) |
501 :returns: filtered version of the graph |
481 :returns: filtered version of the graph |
502 :rtype: PackageDAG |
482 :rtype: PackageDAG |
503 </p> |
483 </p> |
504 <p> |
|
505 |
|
506 </p> |
|
507 <a NAME="PackageDAG.get_children" ID="PackageDAG.get_children"></a> |
484 <a NAME="PackageDAG.get_children" ID="PackageDAG.get_children"></a> |
508 <h4>PackageDAG.get_children</h4> |
485 <h4>PackageDAG.get_children</h4> |
509 <b>get_children</b>(<i>node_key</i>) |
486 <b>get_children</b>(<i>node_key</i>) |
510 |
487 |
511 <p> |
488 <p> |
512 Get child nodes for a node by it's key |
489 Get child nodes for a node by its key |
513 </p> |
490 </p> |
514 <p> |
491 <p> |
515 :param str node_key: key of the node to get children of |
492 :param str node_key: key of the node to get children of |
516 :returns: list of child nodes |
493 :returns: list of child nodes |
517 :rtype: ReqPackage[] |
494 :rtype: ReqPackage[] |
518 </p> |
495 </p> |
519 <p> |
|
520 |
|
521 </p> |
|
522 <a NAME="PackageDAG.get_node_as_parent" ID="PackageDAG.get_node_as_parent"></a> |
496 <a NAME="PackageDAG.get_node_as_parent" ID="PackageDAG.get_node_as_parent"></a> |
523 <h4>PackageDAG.get_node_as_parent</h4> |
497 <h4>PackageDAG.get_node_as_parent</h4> |
524 <b>get_node_as_parent</b>(<i>node_key</i>) |
498 <b>get_node_as_parent</b>(<i>node_key</i>) |
525 |
499 |
526 <p> |
500 <p> |
527 Get the node from the keys of the dict representing the DAG. |
501 Get the node from the keys of the dict representing the DAG. |
528 </p> |
502 </p> |
529 <p> |
503 <p> |
530 This method is useful if the dict representing the DAG |
504 This method is useful if the dict representing the DAG contains different kind of objects in keys and values. |
531 contains different kind of objects in keys and values. Use |
505 Use this method to look up a node obj as a parent (from the keys of the dict) given a node key. |
532 this method to lookup a node obj as a parent (from the keys of |
|
533 the dict) given a node key. |
|
534 </p> |
506 </p> |
535 <p> |
507 <p> |
536 :param node_key: identifier corresponding to key attr of node obj |
508 :param node_key: identifier corresponding to key attr of node obj |
537 :returns: node obj (as present in the keys of the dict) |
509 :returns: node obj (as present in the keys of the dict) |
538 :rtype: Object |
510 :rtype: Object |
539 </p> |
511 </p> |
540 <p> |
|
541 |
|
542 </p> |
|
543 <a NAME="PackageDAG.reverse" ID="PackageDAG.reverse"></a> |
512 <a NAME="PackageDAG.reverse" ID="PackageDAG.reverse"></a> |
544 <h4>PackageDAG.reverse</h4> |
513 <h4>PackageDAG.reverse</h4> |
545 <b>reverse</b>(<i></i>) |
514 <b>reverse</b>(<i></i>) |
546 |
515 |
547 <p> |
516 <p> |
548 Reverse the DAG, or turn it upside-down |
517 Reverse the DAG, or turn it upside-down. |
549 </p> |
518 </p> |
550 <p> |
519 <p> |
551 In other words, the directions of edges of the nodes in the |
520 In other words, the directions of edges of the nodes in the DAG will be reversed. |
552 DAG will be reversed. |
521 </p> |
553 </p> |
522 <p> |
554 <p> |
523 Note that this function purely works on the nodes in the graph. This implies that to perform a combination of |
555 Note that this function purely works on the nodes in the |
524 filtering and reversing, the order in which `filter` and `reverse` methods should be applied is important. For |
556 graph. This implies that to perform a combination of filtering |
525 e.g., if reverse is called on a filtered graph, then only the filtered nodes and it's children will be |
557 and reversing, the order in which `filter` and `reverse` |
526 considered when reversing. On the other hand, if filter is called on reversed DAG, then the definition of |
558 methods should be applied is important. For eg. if reverse is |
527 "child" nodes is as per the reversed DAG. |
559 called on a filtered graph, then only the filtered nodes and |
|
560 it's children will be considered when reversing. On the other |
|
561 hand, if filter is called on reversed DAG, then the definition |
|
562 of "child" nodes is as per the reversed DAG. |
|
563 </p> |
528 </p> |
564 <p> |
529 <p> |
565 :returns: DAG in the reversed form |
530 :returns: DAG in the reversed form |
566 :rtype: ReversedPackageDAG |
531 :rtype: ReversedPackageDAG |
567 </p> |
|
568 <p> |
|
569 |
|
570 </p> |
532 </p> |
571 <a NAME="PackageDAG.sort" ID="PackageDAG.sort"></a> |
533 <a NAME="PackageDAG.sort" ID="PackageDAG.sort"></a> |
572 <h4>PackageDAG.sort</h4> |
534 <h4>PackageDAG.sort</h4> |
573 <b>sort</b>(<i></i>) |
535 <b>sort</b>(<i></i>) |
574 |
536 |
575 <p> |
537 <p> |
576 Return sorted tree in which the underlying _obj dict is an |
538 Return sorted tree in which the underlying _obj dict is an dict, sorted alphabetically by the keys. |
577 OrderedDict, sorted alphabetically by the keys |
539 </p> |
578 </p> |
540 <p> |
579 <p> |
541 :returns: Instance of same class with dict |
580 :returns: Instance of same class with OrderedDict |
|
581 </p> |
|
582 <p> |
|
583 |
|
584 </p> |
542 </p> |
585 <div align="right"><a href="#top">Up</a></div> |
543 <div align="right"><a href="#top">Up</a></div> |
586 <hr /> |
544 <hr /> |
587 <hr /> |
545 <hr /> |
588 <a NAME="ReqPackage" ID="ReqPackage"></a> |
546 <a NAME="ReqPackage" ID="ReqPackage"></a> |
589 <h2>ReqPackage</h2> |
547 <h2>ReqPackage</h2> |
590 |
548 |
591 <p> |
549 <p> |
592 Wrapper class for Requirements instance |
550 Wrapper class for Requirements instance |
593 </p> |
551 </p> |
594 <p> |
552 <p> |
595 :param obj: The `Requirements` instance to wrap over |
553 :param obj: The `Requirements` instance to wrap over |
596 :param dist: optional `pkg_resources.Distribution` instance for |
554 :param dist: optional `pkg_resources.Distribution` instance for this requirement |
597 this requirement |
|
598 </p> |
555 </p> |
599 <h3>Derived from</h3> |
556 <h3>Derived from</h3> |
600 Package |
557 Package |
601 <h3>Class Attributes</h3> |
558 <h3>Class Attributes</h3> |
602 |
559 |
760 <div align="right"><a href="#top">Up</a></div> |
707 <div align="right"><a href="#top">Up</a></div> |
761 <hr /> |
708 <hr /> |
762 <hr /> |
709 <hr /> |
763 <a NAME="aux" ID="aux"></a> |
710 <a NAME="aux" ID="aux"></a> |
764 <h2>aux</h2> |
711 <h2>aux</h2> |
765 <b>aux</b>(<i>node, parent=None, indent=0, chain=None</i>) |
712 <b>aux</b>(<i>node, parent=None, indent=0, cur_chain=None</i>) |
766 |
713 |
767 <div align="right"><a href="#top">Up</a></div> |
714 <div align="right"><a href="#top">Up</a></div> |
768 <hr /> |
715 <hr /> |
769 <hr /> |
716 <hr /> |
770 <a NAME="aux_1" ID="aux_1"></a> |
717 <a NAME="aux_1" ID="aux_1"></a> |
771 <h2>aux</h2> |
718 <h2>aux</h2> |
772 <b>aux</b>(<i>node, parent=None, chain=None</i>) |
719 <b>aux</b>(<i>node, parent=None, cur_chain=None</i>) |
773 |
720 |
774 <div align="right"><a href="#top">Up</a></div> |
721 <div align="right"><a href="#top">Up</a></div> |
775 <hr /> |
722 <hr /> |
776 <hr /> |
723 <hr /> |
777 <a NAME="conflicting_deps" ID="conflicting_deps"></a> |
724 <a NAME="conflicting_deps" ID="conflicting_deps"></a> |
778 <h2>conflicting_deps</h2> |
725 <h2>conflicting_deps</h2> |
779 <b>conflicting_deps</b>(<i>tree</i>) |
726 <b>conflicting_deps</b>(<i>tree</i>) |
780 |
727 |
781 <p> |
728 <p> |
782 Returns dependencies which are not present or conflict with the |
729 Returns dependencies which are not present or conflict with the requirements of other packages. |
783 requirements of other packages. |
|
784 </p> |
730 </p> |
785 <p> |
731 <p> |
786 e.g. will warn if pkg1 requires pkg2==2.0 and pkg2==1.0 is installed |
732 e.g. will warn if pkg1 requires pkg2==2.0 and pkg2==1.0 is installed |
787 </p> |
733 </p> |
788 <p> |
734 <p> |
789 :param tree: the requirements tree (dict) |
735 :param tree: the requirements tree (dict) |
790 :returns: dict of DistPackage -> list of unsatisfied/unknown ReqPackage |
736 :returns: dict of DistPackage -> list of unsatisfied/unknown ReqPackage |
791 :rtype: dict |
737 :rtype: dict |
792 </p> |
738 </p> |
793 <p> |
|
794 |
|
795 </p> |
|
796 <div align="right"><a href="#top">Up</a></div> |
739 <div align="right"><a href="#top">Up</a></div> |
797 <hr /> |
740 <hr /> |
798 <hr /> |
741 <hr /> |
799 <a NAME="cyclic_deps" ID="cyclic_deps"></a> |
742 <a NAME="cyclic_deps" ID="cyclic_deps"></a> |
800 <h2>cyclic_deps</h2> |
743 <h2>cyclic_deps</h2> |
801 <b>cyclic_deps</b>(<i>tree</i>) |
744 <b>cyclic_deps</b>(<i>tree</i>) |
802 |
745 |
803 <p> |
746 <p> |
804 Return cyclic dependencies as list of tuples |
747 Return cyclic dependencies as list of tuples |
805 </p> |
748 </p> |
806 <p> |
749 <p> |
807 :param PackageDAG pkgs: package tree/dag |
750 :param PackageDAG tree: package tree/dag |
808 :returns: list of tuples representing cyclic dependencies |
751 :returns: list of tuples representing cyclic dependencies |
809 :rtype: list |
752 :rtype: list |
810 </p> |
753 </p> |
811 <p> |
|
812 |
|
813 </p> |
|
814 <div align="right"><a href="#top">Up</a></div> |
754 <div align="right"><a href="#top">Up</a></div> |
815 <hr /> |
755 <hr /> |
816 <hr /> |
756 <hr /> |
817 <a NAME="dump_graphviz" ID="dump_graphviz"></a> |
757 <a NAME="dump_graphviz" ID="dump_graphviz"></a> |
818 <h2>dump_graphviz</h2> |
758 <h2>dump_graphviz</h2> |
819 <b>dump_graphviz</b>(<i>tree, output_format='dot', is_reverse=False</i>) |
759 <b>dump_graphviz</b>(<i>tree, output_format="dot", is_reverse=False</i>) |
820 |
760 |
821 <p> |
761 <p> |
822 Output dependency graph as one of the supported GraphViz output formats. |
762 Output dependency graph as one of the supported GraphViz output formats. |
823 </p> |
763 </p> |
824 <p> |
764 <p> |
825 :param dict tree: dependency graph |
765 :param dict tree: dependency graph |
826 :param string output_format: output format |
766 :param string output_format: output format |
|
767 :param bool is_reverse: reverse or not |
827 :returns: representation of tree in the specified output format |
768 :returns: representation of tree in the specified output format |
828 :rtype: str or binary representation depending on the output format |
769 :rtype: str or binary representation depending on the output format |
829 </p> |
770 </p> |
830 <p> |
771 <p> |
831 |
772 |
930 :param dict tree: dependency tree |
868 :param dict tree: dependency tree |
931 :param int indent: no. of spaces to indent json |
869 :param int indent: no. of spaces to indent json |
932 :returns: json representation of the tree |
870 :returns: json representation of the tree |
933 :rtype: str |
871 :rtype: str |
934 </p> |
872 </p> |
935 <p> |
|
936 |
|
937 </p> |
|
938 <div align="right"><a href="#top">Up</a></div> |
873 <div align="right"><a href="#top">Up</a></div> |
939 <hr /> |
874 <hr /> |
940 <hr /> |
875 <hr /> |
941 <a NAME="render_json_tree" ID="render_json_tree"></a> |
876 <a NAME="render_json_tree" ID="render_json_tree"></a> |
942 <h2>render_json_tree</h2> |
877 <h2>render_json_tree</h2> |
943 <b>render_json_tree</b>(<i>tree, indent</i>) |
878 <b>render_json_tree</b>(<i>tree, indent</i>) |
944 |
879 |
945 <p> |
880 <p> |
946 Converts the tree into a nested json representation. |
881 Converts the tree into a nested json representation. |
947 </p> |
882 </p> |
948 <p> |
883 <p> |
949 The json repr will be a list of hashes, each hash having the following fields: |
884 The json repr will be a list of hashes, each hash having the following fields: |
|
885 </p> |
|
886 <p> |
950 - package_name |
887 - package_name |
951 - key |
888 - key |
952 - required_version |
889 - required_version |
953 - installed_version |
890 - installed_version |
954 - dependencies: list of dependencies |
891 - dependencies: list of dependencies |