annet 3.3.0__tar.gz → 3.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of annet might be problematic. Click here for more details.

Files changed (225) hide show
  1. {annet-3.3.0/annet.egg-info → annet-3.4.1}/PKG-INFO +1 -1
  2. {annet-3.3.0 → annet-3.4.1}/annet/api/__init__.py +68 -45
  3. {annet-3.3.0 → annet-3.4.1}/annet/generators/__init__.py +9 -5
  4. {annet-3.3.0 → annet-3.4.1/annet.egg-info}/PKG-INFO +1 -1
  5. {annet-3.3.0 → annet-3.4.1}/AUTHORS +0 -0
  6. {annet-3.3.0 → annet-3.4.1}/LICENSE +0 -0
  7. {annet-3.3.0 → annet-3.4.1}/MANIFEST.in +0 -0
  8. {annet-3.3.0 → annet-3.4.1}/README.md +0 -0
  9. {annet-3.3.0 → annet-3.4.1}/annet/__init__.py +0 -0
  10. {annet-3.3.0 → annet-3.4.1}/annet/adapters/__init__.py +0 -0
  11. {annet-3.3.0 → annet-3.4.1}/annet/adapters/fetchers/__init__.py +0 -0
  12. {annet-3.3.0 → annet-3.4.1}/annet/adapters/fetchers/stub/__init__.py +0 -0
  13. {annet-3.3.0 → annet-3.4.1}/annet/adapters/fetchers/stub/fetcher.py +0 -0
  14. {annet-3.3.0 → annet-3.4.1}/annet/adapters/file/__init__.py +0 -0
  15. {annet-3.3.0 → annet-3.4.1}/annet/adapters/file/provider.py +0 -0
  16. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/__init__.py +0 -0
  17. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/common/__init__.py +0 -0
  18. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/common/adapter.py +0 -0
  19. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/common/client.py +0 -0
  20. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/common/manufacturer.py +0 -0
  21. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/common/models.py +0 -0
  22. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/common/query.py +0 -0
  23. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/common/status_client.py +0 -0
  24. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/common/storage_base.py +0 -0
  25. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/common/storage_opts.py +0 -0
  26. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/provider.py +0 -0
  27. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/v24/__init__.py +0 -0
  28. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/v24/models.py +0 -0
  29. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/v24/storage.py +0 -0
  30. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/v37/__init__.py +0 -0
  31. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/v37/models.py +0 -0
  32. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/v37/storage.py +0 -0
  33. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/v41/__init__.py +0 -0
  34. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/v41/models.py +0 -0
  35. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/v41/storage.py +0 -0
  36. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/v42/__init__.py +0 -0
  37. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/v42/models.py +0 -0
  38. {annet-3.3.0 → annet-3.4.1}/annet/adapters/netbox/v42/storage.py +0 -0
  39. {annet-3.3.0 → annet-3.4.1}/annet/annet.py +0 -0
  40. {annet-3.3.0 → annet-3.4.1}/annet/annlib/__init__.py +0 -0
  41. {annet-3.3.0 → annet-3.4.1}/annet/annlib/command.py +0 -0
  42. {annet-3.3.0 → annet-3.4.1}/annet/annlib/diff.py +0 -0
  43. {annet-3.3.0 → annet-3.4.1}/annet/annlib/errors.py +0 -0
  44. {annet-3.3.0 → annet-3.4.1}/annet/annlib/filter_acl.py +0 -0
  45. {annet-3.3.0 → annet-3.4.1}/annet/annlib/jsontools.py +0 -0
  46. {annet-3.3.0 → annet-3.4.1}/annet/annlib/lib.py +0 -0
  47. {annet-3.3.0 → annet-3.4.1}/annet/annlib/netdev/__init__.py +0 -0
  48. {annet-3.3.0 → annet-3.4.1}/annet/annlib/netdev/db.py +0 -0
  49. {annet-3.3.0 → annet-3.4.1}/annet/annlib/netdev/devdb/__init__.py +0 -0
  50. {annet-3.3.0 → annet-3.4.1}/annet/annlib/netdev/devdb/data/devdb.json +0 -0
  51. {annet-3.3.0 → annet-3.4.1}/annet/annlib/netdev/views/__init__.py +0 -0
  52. {annet-3.3.0 → annet-3.4.1}/annet/annlib/netdev/views/dump.py +0 -0
  53. {annet-3.3.0 → annet-3.4.1}/annet/annlib/netdev/views/hardware.py +0 -0
  54. {annet-3.3.0 → annet-3.4.1}/annet/annlib/output.py +0 -0
  55. {annet-3.3.0 → annet-3.4.1}/annet/annlib/patching.py +0 -0
  56. {annet-3.3.0 → annet-3.4.1}/annet/annlib/rbparser/__init__.py +0 -0
  57. {annet-3.3.0 → annet-3.4.1}/annet/annlib/rbparser/acl.py +0 -0
  58. {annet-3.3.0 → annet-3.4.1}/annet/annlib/rbparser/deploying.py +0 -0
  59. {annet-3.3.0 → annet-3.4.1}/annet/annlib/rbparser/ordering.py +0 -0
  60. {annet-3.3.0 → annet-3.4.1}/annet/annlib/rbparser/platform.py +0 -0
  61. {annet-3.3.0 → annet-3.4.1}/annet/annlib/rbparser/syntax.py +0 -0
  62. {annet-3.3.0 → annet-3.4.1}/annet/annlib/rulebook/__init__.py +0 -0
  63. {annet-3.3.0 → annet-3.4.1}/annet/annlib/rulebook/common.py +0 -0
  64. {annet-3.3.0 → annet-3.4.1}/annet/annlib/tabparser.py +0 -0
  65. {annet-3.3.0 → annet-3.4.1}/annet/annlib/types.py +0 -0
  66. {annet-3.3.0 → annet-3.4.1}/annet/argparse.py +0 -0
  67. {annet-3.3.0 → annet-3.4.1}/annet/bgp_models.py +0 -0
  68. {annet-3.3.0 → annet-3.4.1}/annet/cli.py +0 -0
  69. {annet-3.3.0 → annet-3.4.1}/annet/cli_args.py +0 -0
  70. {annet-3.3.0 → annet-3.4.1}/annet/configs/context.yml +0 -0
  71. {annet-3.3.0 → annet-3.4.1}/annet/configs/logging.yaml +0 -0
  72. {annet-3.3.0 → annet-3.4.1}/annet/connectors.py +0 -0
  73. {annet-3.3.0 → annet-3.4.1}/annet/deploy.py +0 -0
  74. {annet-3.3.0 → annet-3.4.1}/annet/deploy_ui.py +0 -0
  75. {annet-3.3.0 → annet-3.4.1}/annet/diff.py +0 -0
  76. {annet-3.3.0 → annet-3.4.1}/annet/executor.py +0 -0
  77. {annet-3.3.0 → annet-3.4.1}/annet/filtering.py +0 -0
  78. {annet-3.3.0 → annet-3.4.1}/annet/gen.py +0 -0
  79. {annet-3.3.0 → annet-3.4.1}/annet/generators/base.py +0 -0
  80. {annet-3.3.0 → annet-3.4.1}/annet/generators/common/__init__.py +0 -0
  81. {annet-3.3.0 → annet-3.4.1}/annet/generators/common/initial.py +0 -0
  82. {annet-3.3.0 → annet-3.4.1}/annet/generators/entire.py +0 -0
  83. {annet-3.3.0 → annet-3.4.1}/annet/generators/exceptions.py +0 -0
  84. {annet-3.3.0 → annet-3.4.1}/annet/generators/jsonfragment.py +0 -0
  85. {annet-3.3.0 → annet-3.4.1}/annet/generators/partial.py +0 -0
  86. {annet-3.3.0 → annet-3.4.1}/annet/generators/perf.py +0 -0
  87. {annet-3.3.0 → annet-3.4.1}/annet/generators/ref.py +0 -0
  88. {annet-3.3.0 → annet-3.4.1}/annet/generators/result.py +0 -0
  89. {annet-3.3.0 → annet-3.4.1}/annet/hardware.py +0 -0
  90. {annet-3.3.0 → annet-3.4.1}/annet/implicit.py +0 -0
  91. {annet-3.3.0 → annet-3.4.1}/annet/lib.py +0 -0
  92. {annet-3.3.0 → annet-3.4.1}/annet/mesh/__init__.py +0 -0
  93. {annet-3.3.0 → annet-3.4.1}/annet/mesh/basemodel.py +0 -0
  94. {annet-3.3.0 → annet-3.4.1}/annet/mesh/device_models.py +0 -0
  95. {annet-3.3.0 → annet-3.4.1}/annet/mesh/executor.py +0 -0
  96. {annet-3.3.0 → annet-3.4.1}/annet/mesh/match_args.py +0 -0
  97. {annet-3.3.0 → annet-3.4.1}/annet/mesh/models_converter.py +0 -0
  98. {annet-3.3.0 → annet-3.4.1}/annet/mesh/peer_models.py +0 -0
  99. {annet-3.3.0 → annet-3.4.1}/annet/mesh/port_processor.py +0 -0
  100. {annet-3.3.0 → annet-3.4.1}/annet/mesh/registry.py +0 -0
  101. {annet-3.3.0 → annet-3.4.1}/annet/output.py +0 -0
  102. {annet-3.3.0 → annet-3.4.1}/annet/parallel.py +0 -0
  103. {annet-3.3.0 → annet-3.4.1}/annet/patching.py +0 -0
  104. {annet-3.3.0 → annet-3.4.1}/annet/reference.py +0 -0
  105. {annet-3.3.0 → annet-3.4.1}/annet/rpl/__init__.py +0 -0
  106. {annet-3.3.0 → annet-3.4.1}/annet/rpl/action.py +0 -0
  107. {annet-3.3.0 → annet-3.4.1}/annet/rpl/condition.py +0 -0
  108. {annet-3.3.0 → annet-3.4.1}/annet/rpl/match_builder.py +0 -0
  109. {annet-3.3.0 → annet-3.4.1}/annet/rpl/policy.py +0 -0
  110. {annet-3.3.0 → annet-3.4.1}/annet/rpl/result.py +0 -0
  111. {annet-3.3.0 → annet-3.4.1}/annet/rpl/routemap.py +0 -0
  112. {annet-3.3.0 → annet-3.4.1}/annet/rpl/statement_builder.py +0 -0
  113. {annet-3.3.0 → annet-3.4.1}/annet/rpl_generators/__init__.py +0 -0
  114. {annet-3.3.0 → annet-3.4.1}/annet/rpl_generators/aspath.py +0 -0
  115. {annet-3.3.0 → annet-3.4.1}/annet/rpl_generators/community.py +0 -0
  116. {annet-3.3.0 → annet-3.4.1}/annet/rpl_generators/cumulus_frr.py +0 -0
  117. {annet-3.3.0 → annet-3.4.1}/annet/rpl_generators/entities.py +0 -0
  118. {annet-3.3.0 → annet-3.4.1}/annet/rpl_generators/execute.py +0 -0
  119. {annet-3.3.0 → annet-3.4.1}/annet/rpl_generators/policy.py +0 -0
  120. {annet-3.3.0 → annet-3.4.1}/annet/rpl_generators/prefix_lists.py +0 -0
  121. {annet-3.3.0 → annet-3.4.1}/annet/rpl_generators/rd.py +0 -0
  122. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/__init__.py +0 -0
  123. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/arista/__init__.py +0 -0
  124. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/arista/aaa.py +0 -0
  125. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/arista/iface.py +0 -0
  126. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/aruba/__init__.py +0 -0
  127. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/aruba/ap_env.py +0 -0
  128. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/aruba/misc.py +0 -0
  129. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/b4com/__init__.py +0 -0
  130. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/b4com/file.py +0 -0
  131. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/b4com/iface.py +0 -0
  132. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/cisco/__init__.py +0 -0
  133. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/cisco/iface.py +0 -0
  134. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/cisco/misc.py +0 -0
  135. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/cisco/vlandb.py +0 -0
  136. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/common.py +0 -0
  137. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/deploying.py +0 -0
  138. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/huawei/__init__.py +0 -0
  139. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/huawei/aaa.py +0 -0
  140. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/huawei/bgp.py +0 -0
  141. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/huawei/iface.py +0 -0
  142. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/huawei/misc.py +0 -0
  143. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/huawei/vlandb.py +0 -0
  144. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/juniper/__init__.py +0 -0
  145. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/nexus/__init__.py +0 -0
  146. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/nexus/iface.py +0 -0
  147. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/patching.py +0 -0
  148. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/routeros/__init__.py +0 -0
  149. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/routeros/file.py +0 -0
  150. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/arista.deploy +0 -0
  151. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/arista.order +0 -0
  152. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/arista.rul +0 -0
  153. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/aruba.deploy +0 -0
  154. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/aruba.order +0 -0
  155. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/aruba.rul +0 -0
  156. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/b4com.deploy +0 -0
  157. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/b4com.order +0 -0
  158. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/b4com.rul +0 -0
  159. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/cisco.deploy +0 -0
  160. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/cisco.order +0 -0
  161. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/cisco.rul +0 -0
  162. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/huawei.deploy +0 -0
  163. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/huawei.order +0 -0
  164. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/huawei.rul +0 -0
  165. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/iosxr.deploy +0 -0
  166. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/iosxr.order +0 -0
  167. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/iosxr.rul +0 -0
  168. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/juniper.order +0 -0
  169. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/juniper.rul +0 -0
  170. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/nexus.deploy +0 -0
  171. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/nexus.order +0 -0
  172. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/nexus.rul +0 -0
  173. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/nokia.rul +0 -0
  174. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/optixtrans.deploy +0 -0
  175. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/optixtrans.order +0 -0
  176. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/optixtrans.rul +0 -0
  177. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/pc.deploy +0 -0
  178. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/pc.order +0 -0
  179. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/pc.rul +0 -0
  180. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/ribbon.deploy +0 -0
  181. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/ribbon.rul +0 -0
  182. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/routeros.order +0 -0
  183. {annet-3.3.0 → annet-3.4.1}/annet/rulebook/texts/routeros.rul +0 -0
  184. {annet-3.3.0 → annet-3.4.1}/annet/storage.py +0 -0
  185. {annet-3.3.0 → annet-3.4.1}/annet/text_term_format.py +0 -0
  186. {annet-3.3.0 → annet-3.4.1}/annet/tracing.py +0 -0
  187. {annet-3.3.0 → annet-3.4.1}/annet/types.py +0 -0
  188. {annet-3.3.0 → annet-3.4.1}/annet/vendors/__init__.py +0 -0
  189. {annet-3.3.0 → annet-3.4.1}/annet/vendors/base.py +0 -0
  190. {annet-3.3.0 → annet-3.4.1}/annet/vendors/library/__init__.py +0 -0
  191. {annet-3.3.0 → annet-3.4.1}/annet/vendors/library/arista.py +0 -0
  192. {annet-3.3.0 → annet-3.4.1}/annet/vendors/library/aruba.py +0 -0
  193. {annet-3.3.0 → annet-3.4.1}/annet/vendors/library/b4com.py +0 -0
  194. {annet-3.3.0 → annet-3.4.1}/annet/vendors/library/cisco.py +0 -0
  195. {annet-3.3.0 → annet-3.4.1}/annet/vendors/library/h3c.py +0 -0
  196. {annet-3.3.0 → annet-3.4.1}/annet/vendors/library/huawei.py +0 -0
  197. {annet-3.3.0 → annet-3.4.1}/annet/vendors/library/iosxr.py +0 -0
  198. {annet-3.3.0 → annet-3.4.1}/annet/vendors/library/juniper.py +0 -0
  199. {annet-3.3.0 → annet-3.4.1}/annet/vendors/library/nexus.py +0 -0
  200. {annet-3.3.0 → annet-3.4.1}/annet/vendors/library/nokia.py +0 -0
  201. {annet-3.3.0 → annet-3.4.1}/annet/vendors/library/optixtrans.py +0 -0
  202. {annet-3.3.0 → annet-3.4.1}/annet/vendors/library/pc.py +0 -0
  203. {annet-3.3.0 → annet-3.4.1}/annet/vendors/library/ribbon.py +0 -0
  204. {annet-3.3.0 → annet-3.4.1}/annet/vendors/library/routeros.py +0 -0
  205. {annet-3.3.0 → annet-3.4.1}/annet/vendors/registry.py +0 -0
  206. {annet-3.3.0 → annet-3.4.1}/annet.egg-info/SOURCES.txt +0 -0
  207. {annet-3.3.0 → annet-3.4.1}/annet.egg-info/dependency_links.txt +0 -0
  208. {annet-3.3.0 → annet-3.4.1}/annet.egg-info/entry_points.txt +0 -0
  209. {annet-3.3.0 → annet-3.4.1}/annet.egg-info/requires.txt +0 -0
  210. {annet-3.3.0 → annet-3.4.1}/annet.egg-info/top_level.txt +0 -0
  211. {annet-3.3.0 → annet-3.4.1}/annet_generators/__init__.py +0 -0
  212. {annet-3.3.0 → annet-3.4.1}/annet_generators/example/__init__.py +0 -0
  213. {annet-3.3.0 → annet-3.4.1}/annet_generators/example/hostname.py +0 -0
  214. {annet-3.3.0 → annet-3.4.1}/annet_generators/example/lldp.py +0 -0
  215. {annet-3.3.0 → annet-3.4.1}/annet_generators/mesh_example/__init__.py +0 -0
  216. {annet-3.3.0 → annet-3.4.1}/annet_generators/mesh_example/bgp.py +0 -0
  217. {annet-3.3.0 → annet-3.4.1}/annet_generators/mesh_example/mesh_logic.py +0 -0
  218. {annet-3.3.0 → annet-3.4.1}/annet_generators/rpl_example/__init__.py +0 -0
  219. {annet-3.3.0 → annet-3.4.1}/annet_generators/rpl_example/generator.py +0 -0
  220. {annet-3.3.0 → annet-3.4.1}/annet_generators/rpl_example/items.py +0 -0
  221. {annet-3.3.0 → annet-3.4.1}/annet_generators/rpl_example/mesh.py +0 -0
  222. {annet-3.3.0 → annet-3.4.1}/annet_generators/rpl_example/route_policy.py +0 -0
  223. {annet-3.3.0 → annet-3.4.1}/requirements.txt +0 -0
  224. {annet-3.3.0 → annet-3.4.1}/setup.cfg +0 -0
  225. {annet-3.3.0 → annet-3.4.1}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: annet
3
- Version: 3.3.0
3
+ Version: 3.4.1
4
4
  Summary: annet
5
5
  Home-page: https://github.com/annetutil/annet
6
6
  License: MIT
@@ -6,9 +6,10 @@ import sys
6
6
  import time
7
7
  import warnings
8
8
  from collections import OrderedDict as odict
9
- from itertools import groupby, chain
9
+ from itertools import chain, groupby
10
10
  from operator import itemgetter
11
11
  from typing import (
12
+ Any,
12
13
  Dict,
13
14
  Generator,
14
15
  Iterable,
@@ -16,39 +17,37 @@ from typing import (
16
17
  Mapping,
17
18
  Set,
18
19
  Tuple,
19
- Union, cast, Any,
20
+ Union,
21
+ cast,
20
22
  )
21
23
 
22
24
  import colorama
25
+ from contextlog import get_logger
26
+
23
27
  import annet.deploy
24
28
  import annet.deploy_ui
25
29
  import annet.lib
26
- from annet.annlib import jsontools
27
- from annet.annlib.netdev.views.hardware import HardwareView
28
- from annet.annlib.types import GeneratorType
29
- from contextlog import get_logger
30
-
31
- from annet.deploy import Fetcher, DeployDriver
32
30
  from annet import cli_args
33
31
  from annet import diff as ann_diff
34
32
  from annet import filtering
35
33
  from annet import gen as ann_gen
36
34
  from annet import patching, rulebook, tabparser, tracing
35
+ from annet.annlib import jsontools
36
+ from annet.annlib.netdev.views.hardware import HardwareView
37
+ from annet.annlib.types import GeneratorType
38
+ from annet.deploy import DeployDriver, Fetcher
37
39
  from annet.diff import file_differ_connector
38
- from annet.rulebook import deploying
39
40
  from annet.filtering import Filterer
40
41
  from annet.hardware import hardware_connector
41
- from annet.output import (
42
- format_file_diff,
43
- output_driver_connector,
44
- print_err_label,
45
- )
42
+ from annet.output import format_file_diff, output_driver_connector, print_err_label
46
43
  from annet.parallel import Parallel, TaskResult
47
44
  from annet.reference import RefTracker
45
+ from annet.rulebook import deploying
48
46
  from annet.storage import Device, get_storage
49
- from annet.types import Diff, ExitCode, OldNewResult, Op, PCDiff, PCDiffFile
47
+ from annet.types import Diff, ExitCode, OldNewResult, Op, PCDiff
50
48
  from annet.vendors import registry_connector
51
49
 
50
+
52
51
  DEFAULT_INDENT = " "
53
52
 
54
53
 
@@ -96,21 +95,45 @@ def _read_old_new_diff_patch(old: Dict[str, Dict], new: Dict[str, Dict], hw: Har
96
95
  return rb, diff_obj, pre, patchtree
97
96
 
98
97
 
99
- def _read_old_new_hw(old_path: str, new_path: str, args: cli_args.FileInputOptions):
98
+ def _read_old_new_configs(old_path, new_path):
99
+ _logger = get_logger()
100
+ with open(old_path) as f:
101
+ _logger.debug("Reading %r ...", old_path)
102
+ old_config = f.read()
103
+
104
+ with open(new_path) as f:
105
+ _logger.debug("Reading %r ...", new_path)
106
+ new_config = f.read()
107
+
108
+ return old_config, new_config
109
+
110
+
111
+ def _read_old_new_hw(old_path: str, old_config: str, new_path: str, new_config: str, args: cli_args.FileInputOptions):
100
112
  _logger = get_logger()
113
+
101
114
  hw = args.hw
102
115
  if isinstance(args.hw, str):
103
116
  hw = HardwareView(args.hw, "")
104
117
 
105
- old, old_hw, old_score = _read_device_config(old_path, hw)
106
- new, new_hw, new_score = _read_device_config(new_path, hw)
118
+ try:
119
+ old, old_hw, old_score = _parse_device_config(old_config, hw)
120
+ except tabparser.ParserError:
121
+ _logger.exception("Parser error: %r", old_path)
122
+ raise
123
+
124
+ try:
125
+ new, new_hw, new_score = _parse_device_config(new_config, hw)
126
+ except tabparser.ParserError:
127
+ _logger.exception("Parser error: %r", new_path)
128
+ raise
129
+
107
130
  hw = new_hw
108
131
  if old_score > new_score:
109
132
  hw = old_hw
110
133
  if old_hw != new_hw:
111
- _logger.debug("Old and new detected hw differs, assume %r", hw)
112
- dest_name = os.path.basename(new_path)
113
- return dest_name, old, new, hw
134
+ _logger.warning("Old and new detected hw differs, assume %r", hw)
135
+
136
+ return old, new, hw
114
137
 
115
138
 
116
139
  @tracing.function
@@ -134,27 +157,19 @@ def _read_old_new_cfgdumps(args: cli_args.FileInputOptions):
134
157
  yield (old_path_name, new_path_name)
135
158
 
136
159
 
137
- def _read_device_config(path, hw):
138
- _logger = get_logger()
139
- _logger.debug("Reading %r ...", path)
160
+ def _parse_device_config(text, hw):
140
161
  score = 1
141
162
  vendor_registry = registry_connector.get()
142
163
 
143
- with open(path) as cfgdump_file:
144
- text = cfgdump_file.read()
145
- try:
146
- if not hw:
147
- hw, score = guess_hw(text)
164
+ if not hw:
165
+ hw, score = guess_hw(text)
148
166
 
149
- config = tabparser.parse_to_tree(
150
- text=text,
151
- splitter=vendor_registry.match(hw).make_formatter().split,
152
- )
167
+ config = tabparser.parse_to_tree(
168
+ text=text,
169
+ splitter=vendor_registry.match(hw).make_formatter().split,
170
+ )
153
171
 
154
- return config, hw, score
155
- except tabparser.ParserError:
156
- _logger.exception("Parser error: %r", path)
157
- raise
172
+ return config, hw, score
158
173
 
159
174
 
160
175
  # =====
@@ -756,12 +771,15 @@ def file_diff_worker(
756
771
  if diff_text:
757
772
  yield diff_file.label, diff_text, False
758
773
  else:
759
- dest_name, old, new, hw = _read_old_new_hw(old_path, new_path, args)
774
+ old_config, new_config = _read_old_new_configs(old_path, new_path)
775
+ if old_config == new_config:
776
+ return
777
+
778
+ old, new, hw = _read_old_new_hw(old_path, old_config, new_path, new_config, args)
760
779
  _, __, pre, ___ = _read_old_new_diff_patch(old, new, hw, add_comments=False)
761
- diff_lines = ann_diff.gen_pre_as_diff(pre, args.show_rules, args.indent, args.no_color)
762
- diff_text = "".join(diff_lines)
763
- if diff_text:
764
- yield dest_name, diff_text, False
780
+
781
+ if diff_lines := ann_diff.gen_pre_as_diff(pre, args.show_rules, args.indent, args.no_color):
782
+ yield os.path.basename(new_path), "".join(diff_lines), False
765
783
 
766
784
 
767
785
  @tracing.function
@@ -773,18 +791,23 @@ def file_patch(args: cli_args.FilePatchOptions):
773
791
 
774
792
 
775
793
  def file_patch_worker(old_new: Tuple[str, str], args: cli_args.FileDiffOptions) -> Generator[
776
- Tuple[str, str, bool], None, None]:
794
+ Tuple[str, str, bool], None, None
795
+ ]:
777
796
  old_path, new_path = old_new
778
797
  if os.path.isdir(old_path) and os.path.isdir(new_path):
779
798
  for relative_cfg_path, cfg_text in ann_gen.load_pc_config(new_path).items():
780
799
  label = os.path.join(os.path.basename(new_path), relative_cfg_path)
781
800
  yield label, cfg_text, False
782
801
  else:
783
- dest_name, old, new, hw = _read_old_new_hw(old_path, new_path, args)
802
+ old_config, new_config = _read_old_new_configs(old_path, new_path)
803
+ if old_config == new_config:
804
+ return
805
+
806
+ old, new, hw = _read_old_new_hw(old_path, old_config, new_path, new_config, args)
784
807
  _, __, ___, patch_tree = _read_old_new_diff_patch(old, new, hw, args.add_comments)
785
808
  patch_text = _format_patch_blocks(patch_tree, hw, args.indent)
786
809
  if patch_text:
787
- yield dest_name, patch_text, False
810
+ yield os.path.basename(new_path), patch_text, False
788
811
 
789
812
 
790
813
  def guess_hw(config_text: str):
@@ -313,17 +313,20 @@ def _run_entire_generator(gen: "Entire", device: "Device") -> Optional[Generator
313
313
 
314
314
  logger.info("Generating ENTIRE ...")
315
315
 
316
- output = gen(device)
316
+ gen_output = gen(device)
317
+ gen_reload = gen.get_reload_cmds(device)
318
+ gen_is_safe = gen.is_safe(device)
319
+ gen_prio = gen.prio
317
320
 
318
321
  return GeneratorEntireResult(
319
322
  name=gen.__class__.__name__,
320
323
  tags=gen.TAGS,
321
324
  path=path,
322
- output=output,
323
- reload=gen.get_reload_cmds(device),
324
- prio=gen.prio,
325
+ output=gen_output,
326
+ reload=gen_reload,
327
+ prio=gen_prio,
325
328
  perf=pm.last_result,
326
- is_safe=gen.is_safe(device),
329
+ is_safe=gen_is_safe,
327
330
  )
328
331
 
329
332
 
@@ -363,6 +366,7 @@ def _run_json_fragment_generator(
363
366
 
364
367
  config = gen(device)
365
368
  reload_cmds = gen.get_reload_cmds(device)
369
+
366
370
  return GeneratorJSONFragmentResult(
367
371
  name=gen.__class__.__name__,
368
372
  tags=gen.TAGS,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: annet
3
- Version: 3.3.0
3
+ Version: 3.4.1
4
4
  Summary: annet
5
5
  Home-page: https://github.com/annetutil/annet
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes