nbforager 0.6.0__tar.gz → 0.8.0__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.
- {nbforager-0.6.0 → nbforager-0.8.0}/PKG-INFO +6 -10
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/helpers.py +311 -1
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/nb_api.py +3 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/parser/nb_parser.py +1 -1
- {nbforager-0.6.0 → nbforager-0.8.0}/pyproject.toml +31 -29
- {nbforager-0.6.0 → nbforager-0.8.0}/LICENSE.txt +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/README.rst +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/__init__.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/api/__init__.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/api/base_ac.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/api/base_c.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/api/circuits.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/api/connector.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/api/core.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/api/dcim.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/api/extended_get.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/api/extras.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/api/ip_addresses.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/api/ipam.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/api/plugins_ca.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/api/status.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/api/tenancy.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/api/users.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/api/virtualization.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/api/wireless.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/exceptions.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/foragers/__init__.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/foragers/base_fa.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/foragers/circuits.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/foragers/core.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/foragers/dcim.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/foragers/extras.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/foragers/forager.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/foragers/ipam.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/foragers/ipv4.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/foragers/joiner.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/foragers/tenancy.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/foragers/users.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/foragers/virtualization.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/foragers/wireless.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/log.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/messages.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/nb_cache.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/nb_forager.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/nb_tree.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/parser/__init__.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/parser/nb_custom.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/parser/nb_value.py +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/py.typed +0 -0
- {nbforager-0.6.0 → nbforager-0.8.0}/nbforager/types_.py +0 -0
@@ -1,33 +1,29 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: nbforager
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.8.0
|
4
4
|
Summary: Python package designed to assist in working with the Netbox REST API. The filter parameters are identical to those in the Web UI filter form. It replaces brief data with full information, and Netbox objects are represented as a recursive multidimensional dictionary.
|
5
5
|
License: Apache-2.0
|
6
6
|
Keywords: netbox
|
7
7
|
Author: Vladimirs Prusakovs
|
8
8
|
Author-email: vladimir.prusakovs@gmail.com
|
9
|
-
Requires-Python: >=3.
|
9
|
+
Requires-Python: >=3.11,<4.0
|
10
10
|
Classifier: Development Status :: 5 - Production/Stable
|
11
11
|
Classifier: Intended Audience :: Developers
|
12
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
13
13
|
Classifier: Natural Language :: English
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
15
|
-
Classifier: Programming Language :: Python :: 3.8
|
16
|
-
Classifier: Programming Language :: Python :: 3.9
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
18
15
|
Classifier: Programming Language :: Python :: 3.11
|
19
16
|
Classifier: Programming Language :: Python :: 3.12
|
20
17
|
Classifier: Programming Language :: Python :: 3.13
|
21
18
|
Provides-Extra: test
|
22
19
|
Requires-Dist: ciscoconfparse (>=1.9,<2.0)
|
23
|
-
Requires-Dist: netports (>=0.
|
20
|
+
Requires-Dist: netports (>=0.17)
|
24
21
|
Requires-Dist: pydantic (>=2,<3)
|
25
22
|
Requires-Dist: requests (>=2,<3)
|
26
|
-
Requires-Dist: tabulate (>=0.9
|
27
|
-
Requires-Dist:
|
28
|
-
Requires-Dist: vhelpers (>=0.3,<1.0.0)
|
23
|
+
Requires-Dist: tabulate (>=0.9,<0.10)
|
24
|
+
Requires-Dist: vhelpers (>=0.3)
|
29
25
|
Project-URL: Bug Tracker, https://github.com/vladimirs-git/nbforager/issues
|
30
|
-
Project-URL: Download URL, https://github.com/vladimirs-git/nbforager/archive/refs/tags/0.
|
26
|
+
Project-URL: Download URL, https://github.com/vladimirs-git/nbforager/archive/refs/tags/0.8.0.tar.gz
|
31
27
|
Project-URL: homepage, https://github.com/vladimirs-git/nbforager
|
32
28
|
Project-URL: repository, https://github.com/vladimirs-git/nbforager
|
33
29
|
Description-Content-Type: text/x-rst
|
@@ -2,15 +2,325 @@
|
|
2
2
|
|
3
3
|
import itertools
|
4
4
|
import urllib
|
5
|
+
from copy import deepcopy
|
5
6
|
from typing import Any
|
6
7
|
from urllib.parse import ParseResult, urlencode, urlparse, parse_qs
|
7
8
|
|
8
9
|
from vhelpers import vlist, vparam, vint
|
9
10
|
|
10
11
|
from nbforager.exceptions import NbApiError
|
11
|
-
from nbforager.types_ import LStr, LDAny, DDDLInt, LValue, LParam, LDList, DList, DLStr
|
12
|
+
from nbforager.types_ import LStr, LDAny, DDDLInt, LValue, LParam, LDList, DList, DLStr, ODLStr
|
12
13
|
from nbforager.types_ import LTInt2, DAny, SeqStr, SStr, TValues, TLists, T2Str, T3Str, T3StrInt
|
13
14
|
|
15
|
+
# Netbox v3.5
|
16
|
+
DEPENDENT_MODELS: DLStr = {
|
17
|
+
"circuits/circuit-terminations": [
|
18
|
+
"circuits/circuits",
|
19
|
+
"circuits/provider-networks",
|
20
|
+
"dcim/cable-terminations",
|
21
|
+
"dcim/sites",
|
22
|
+
"extras/tags",
|
23
|
+
],
|
24
|
+
"circuits/circuit-types": ["extras/tags"],
|
25
|
+
"circuits/circuits": [
|
26
|
+
"circuits/circuit-types",
|
27
|
+
"circuits/provider-accounts",
|
28
|
+
"circuits/providers",
|
29
|
+
"extras/tags",
|
30
|
+
"tenancy/tenants",
|
31
|
+
],
|
32
|
+
"circuits/provider-accounts": ["circuits/providers", "extras/tags"],
|
33
|
+
"circuits/provider-networks": ["circuits/providers", "extras/tags"],
|
34
|
+
"circuits/providers": ["extras/tags", "ipam/asns"],
|
35
|
+
"core/data-files": ["core/data-sources"],
|
36
|
+
"core/data-sources": ["extras/tags"],
|
37
|
+
"core/jobs": ["extras/content-types"],
|
38
|
+
"dcim/cable-terminations": [
|
39
|
+
"dcim/cables",
|
40
|
+
"dcim/devices",
|
41
|
+
"dcim/locations",
|
42
|
+
"dcim/racks",
|
43
|
+
"dcim/sites",
|
44
|
+
],
|
45
|
+
"dcim/cables": ["extras/tags", "tenancy/tenants"],
|
46
|
+
"dcim/console-port-templates": ["dcim/device-types", "dcim/module-types"],
|
47
|
+
"dcim/console-ports": [
|
48
|
+
"dcim/cable-terminations",
|
49
|
+
"dcim/devices",
|
50
|
+
"dcim/modules",
|
51
|
+
"extras/tags",
|
52
|
+
],
|
53
|
+
"dcim/console-server-port-templates": ["dcim/device-types", "dcim/module-types"],
|
54
|
+
"dcim/console-server-ports": [
|
55
|
+
"dcim/cable-terminations",
|
56
|
+
"dcim/devices",
|
57
|
+
"dcim/modules",
|
58
|
+
"extras/tags",
|
59
|
+
],
|
60
|
+
"dcim/device-bay-templates": ["dcim/device-types"],
|
61
|
+
"dcim/device-bays": ["dcim/devices", "extras/tags"],
|
62
|
+
"dcim/device-roles": ["extras/config-templates", "extras/tags"],
|
63
|
+
"dcim/device-types": ["dcim/manufacturers", "extras/tags"],
|
64
|
+
"dcim/devices": [
|
65
|
+
"dcim/device-roles",
|
66
|
+
"dcim/device-types",
|
67
|
+
"dcim/locations",
|
68
|
+
"dcim/platforms",
|
69
|
+
"dcim/racks",
|
70
|
+
"dcim/sites",
|
71
|
+
"dcim/virtual-chassis",
|
72
|
+
"extras/config-templates",
|
73
|
+
"extras/tags",
|
74
|
+
"tenancy/tenants",
|
75
|
+
"virtualization/clusters",
|
76
|
+
],
|
77
|
+
"dcim/front-port-templates": [
|
78
|
+
"dcim/device-types",
|
79
|
+
"dcim/module-types",
|
80
|
+
"dcim/rear-port-templates",
|
81
|
+
],
|
82
|
+
"dcim/front-ports": [
|
83
|
+
"dcim/cable-terminations",
|
84
|
+
"dcim/devices",
|
85
|
+
"dcim/modules",
|
86
|
+
"dcim/rear-ports",
|
87
|
+
"extras/tags",
|
88
|
+
],
|
89
|
+
"dcim/interface-templates": ["dcim/device-types", "dcim/module-types"],
|
90
|
+
"dcim/interfaces": [
|
91
|
+
"dcim/cable-terminations",
|
92
|
+
"dcim/devices",
|
93
|
+
"dcim/modules",
|
94
|
+
"dcim/virtual-device-contexts",
|
95
|
+
"extras/tags",
|
96
|
+
"ipam/ip-addresses",
|
97
|
+
"ipam/l2vpn-terminations",
|
98
|
+
"ipam/vlans",
|
99
|
+
"ipam/vrfs",
|
100
|
+
"virtualization/interfaces",
|
101
|
+
"wireless/wireless-lans",
|
102
|
+
],
|
103
|
+
"dcim/inventory-item-roles": ["extras/tags"],
|
104
|
+
"dcim/inventory-item-templates": [
|
105
|
+
"dcim/device-types",
|
106
|
+
"dcim/inventory-item-roles",
|
107
|
+
"dcim/manufacturers",
|
108
|
+
],
|
109
|
+
"dcim/inventory-items": [
|
110
|
+
"dcim/devices",
|
111
|
+
"dcim/inventory-item-roles",
|
112
|
+
"dcim/manufacturers",
|
113
|
+
"extras/tags",
|
114
|
+
],
|
115
|
+
"dcim/locations": ["dcim/sites", "extras/tags", "ipam/vlan-groups", "tenancy/tenants"],
|
116
|
+
"dcim/manufacturers": ["extras/tags"],
|
117
|
+
"dcim/module-bay-templates": ["dcim/device-types"],
|
118
|
+
"dcim/module-bays": ["dcim/devices", "extras/tags"],
|
119
|
+
"dcim/module-types": ["dcim/manufacturers", "extras/tags"],
|
120
|
+
"dcim/modules": ["dcim/devices", "dcim/module-bays", "dcim/module-types", "extras/tags"],
|
121
|
+
"dcim/platforms": ["dcim/manufacturers", "extras/config-templates", "extras/tags"],
|
122
|
+
"dcim/power-feeds": [
|
123
|
+
"dcim/cable-terminations",
|
124
|
+
"dcim/power-panels",
|
125
|
+
"dcim/racks",
|
126
|
+
"extras/tags",
|
127
|
+
],
|
128
|
+
"dcim/power-outlet-templates": [
|
129
|
+
"dcim/device-types",
|
130
|
+
"dcim/module-types",
|
131
|
+
"dcim/power-port-templates",
|
132
|
+
],
|
133
|
+
"dcim/power-outlets": [
|
134
|
+
"dcim/cable-terminations",
|
135
|
+
"dcim/devices",
|
136
|
+
"dcim/modules",
|
137
|
+
"dcim/power-ports",
|
138
|
+
"extras/tags",
|
139
|
+
],
|
140
|
+
"dcim/power-panels": ["dcim/locations", "dcim/sites", "extras/tags"],
|
141
|
+
"dcim/power-port-templates": ["dcim/device-types", "dcim/module-types"],
|
142
|
+
"dcim/power-ports": ["dcim/cable-terminations", "dcim/devices", "dcim/modules", "extras/tags"],
|
143
|
+
"dcim/rack-reservations": ["dcim/racks", "extras/tags", "tenancy/tenants", "users/users"],
|
144
|
+
"dcim/rack-roles": ["extras/tags"],
|
145
|
+
"dcim/racks": [
|
146
|
+
"dcim/locations",
|
147
|
+
"dcim/rack-roles",
|
148
|
+
"dcim/sites",
|
149
|
+
"extras/tags",
|
150
|
+
"ipam/vlan-groups",
|
151
|
+
"tenancy/tenants",
|
152
|
+
],
|
153
|
+
"dcim/rear-port-templates": ["dcim/device-types", "dcim/module-types"],
|
154
|
+
"dcim/rear-ports": ["dcim/cable-terminations", "dcim/devices", "dcim/modules", "extras/tags"],
|
155
|
+
"dcim/regions": ["extras/tags", "ipam/vlan-groups"],
|
156
|
+
"dcim/site-groups": ["extras/tags", "ipam/vlan-groups"],
|
157
|
+
"dcim/sites": [
|
158
|
+
"dcim/regions",
|
159
|
+
"dcim/site-groups",
|
160
|
+
"extras/tags",
|
161
|
+
"ipam/asns",
|
162
|
+
"ipam/vlan-groups",
|
163
|
+
"tenancy/tenants",
|
164
|
+
],
|
165
|
+
"dcim/virtual-chassis": ["dcim/devices", "extras/tags"],
|
166
|
+
"dcim/virtual-device-contexts": ["dcim/devices", "extras/tags", "tenancy/tenants"],
|
167
|
+
"extras/branchs": ["users/users"],
|
168
|
+
"extras/config-contexts": [
|
169
|
+
"dcim/device-roles",
|
170
|
+
"dcim/device-types",
|
171
|
+
"dcim/locations",
|
172
|
+
"dcim/platforms",
|
173
|
+
"dcim/regions",
|
174
|
+
"dcim/site-groups",
|
175
|
+
"dcim/sites",
|
176
|
+
"extras/tags",
|
177
|
+
"tenancy/tenant-groups",
|
178
|
+
"tenancy/tenants",
|
179
|
+
"virtualization/cluster-groups",
|
180
|
+
"virtualization/cluster-types",
|
181
|
+
"virtualization/clusters",
|
182
|
+
],
|
183
|
+
"extras/config-templates": ["extras/tags"],
|
184
|
+
"extras/content-types": [],
|
185
|
+
"extras/custom-fields": ["extras/content-types"],
|
186
|
+
"extras/custom-links": ["extras/content-types"],
|
187
|
+
"extras/dashboards": ["users/users"],
|
188
|
+
"extras/export-templates": ["extras/content-types"],
|
189
|
+
"extras/image-attachments": ["extras/content-types"],
|
190
|
+
"extras/journal-entries": ["extras/content-types", "extras/tags", "users/users"],
|
191
|
+
"extras/object-changes": ["users/users"],
|
192
|
+
"extras/saved-filters": ["extras/content-types", "users/users"],
|
193
|
+
"extras/tagged-items": ["extras/content-types", "extras/tags"],
|
194
|
+
"extras/tags": [],
|
195
|
+
"extras/webhooks": ["extras/content-types"],
|
196
|
+
"ipam/aggregates": ["extras/tags", "ipam/rirs", "tenancy/tenants"],
|
197
|
+
"ipam/asn-ranges": ["extras/tags", "ipam/rirs", "tenancy/tenants"],
|
198
|
+
"ipam/asns": ["extras/tags", "ipam/rirs", "tenancy/tenants"],
|
199
|
+
"ipam/fhrp-group-assignments": ["extras/content-types", "ipam/fhrp-groups"],
|
200
|
+
"ipam/fhrp-groups": ["extras/tags", "ipam/ip-addresses"],
|
201
|
+
"ipam/ip-addresses": ["extras/tags", "ipam/vrfs", "tenancy/tenants"],
|
202
|
+
"ipam/ip-ranges": ["extras/tags", "ipam/roles", "ipam/vrfs", "tenancy/tenants"],
|
203
|
+
"ipam/l2vpn-terminations": ["extras/tags", "ipam/l2vpns"],
|
204
|
+
"ipam/l2vpns": ["extras/tags", "ipam/route-targets", "tenancy/tenants"],
|
205
|
+
"ipam/prefixes": [
|
206
|
+
"dcim/sites",
|
207
|
+
"extras/tags",
|
208
|
+
"ipam/roles",
|
209
|
+
"ipam/vlans",
|
210
|
+
"ipam/vrfs",
|
211
|
+
"tenancy/tenants",
|
212
|
+
],
|
213
|
+
"ipam/rirs": ["extras/tags"],
|
214
|
+
"ipam/roles": ["extras/tags"],
|
215
|
+
"ipam/route-targets": ["extras/tags", "tenancy/tenants"],
|
216
|
+
"ipam/service-templates": ["extras/tags"],
|
217
|
+
"ipam/services": [
|
218
|
+
"dcim/devices",
|
219
|
+
"extras/tags",
|
220
|
+
"ipam/ip-addresses",
|
221
|
+
"virtualization/virtual-machines",
|
222
|
+
],
|
223
|
+
"ipam/vlan-groups": ["extras/content-types", "extras/tags"],
|
224
|
+
"ipam/vlans": [
|
225
|
+
"dcim/sites",
|
226
|
+
"extras/tags",
|
227
|
+
"ipam/l2vpn-terminations",
|
228
|
+
"ipam/roles",
|
229
|
+
"ipam/vlan-groups",
|
230
|
+
"tenancy/tenants",
|
231
|
+
],
|
232
|
+
"ipam/vrfs": ["extras/tags", "ipam/route-targets", "tenancy/tenants"],
|
233
|
+
"nb_config_checker/tasks": ["extras/tags", "users/users"],
|
234
|
+
"social_django/user-social-auths": ["users/users"],
|
235
|
+
"taggit/tagged-items": ["extras/content-types"],
|
236
|
+
"tenancy/contact-assignments": [
|
237
|
+
"extras/content-types",
|
238
|
+
"tenancy/contact-roles",
|
239
|
+
"tenancy/contacts",
|
240
|
+
],
|
241
|
+
"tenancy/contact-groups": ["extras/tags"],
|
242
|
+
"tenancy/contact-roles": ["extras/tags"],
|
243
|
+
"tenancy/contacts": ["extras/tags", "tenancy/contact-groups"],
|
244
|
+
"tenancy/tenant-groups": ["extras/tags"],
|
245
|
+
"tenancy/tenants": ["extras/tags", "tenancy/tenant-groups"],
|
246
|
+
"users/groups": [],
|
247
|
+
"users/permissions": ["extras/content-types", "users/groups", "users/users"],
|
248
|
+
"users/tokens": ["users/users"],
|
249
|
+
"users/user-preferences": ["users/users"],
|
250
|
+
"users/users": [],
|
251
|
+
"virtualization/cluster-groups": ["extras/tags", "ipam/vlan-groups"],
|
252
|
+
"virtualization/cluster-types": ["extras/tags"],
|
253
|
+
"virtualization/clusters": [
|
254
|
+
"dcim/sites",
|
255
|
+
"extras/tags",
|
256
|
+
"ipam/vlan-groups",
|
257
|
+
"tenancy/tenants",
|
258
|
+
"virtualization/cluster-groups",
|
259
|
+
"virtualization/cluster-types",
|
260
|
+
],
|
261
|
+
"virtualization/interfaces": [
|
262
|
+
"extras/tags",
|
263
|
+
"ipam/ip-addresses",
|
264
|
+
"ipam/l2vpn-terminations",
|
265
|
+
"ipam/vlans",
|
266
|
+
"ipam/vrfs",
|
267
|
+
"virtualization/virtual-machines",
|
268
|
+
],
|
269
|
+
"virtualization/virtual-machines": [
|
270
|
+
"dcim/device-roles",
|
271
|
+
"dcim/devices",
|
272
|
+
"dcim/platforms",
|
273
|
+
"dcim/sites",
|
274
|
+
"extras/tags",
|
275
|
+
"tenancy/tenants",
|
276
|
+
"virtualization/clusters",
|
277
|
+
],
|
278
|
+
"wireless/wireless-lan-groups": ["extras/tags"],
|
279
|
+
"wireless/wireless-lans": [
|
280
|
+
"extras/tags",
|
281
|
+
"ipam/vlans",
|
282
|
+
"tenancy/tenants",
|
283
|
+
"wireless/wireless-lan-groups",
|
284
|
+
],
|
285
|
+
"wireless/wireless-links": ["extras/tags", "tenancy/tenants"],
|
286
|
+
}
|
287
|
+
"""Models dependency for Netbox v3.5"""
|
288
|
+
|
289
|
+
|
290
|
+
def dependency_ordered_paths(dependency: ODLStr = None) -> LStr:
|
291
|
+
"""Order paths based on dependencies. Models with the lowes count dependencies will be first.
|
292
|
+
|
293
|
+
:param dependency: Dictionary representing dependencies,
|
294
|
+
where key is the parent model and value is a list of child models.
|
295
|
+
:return: Ordered paths based on dependencies.
|
296
|
+
:raises ValueError: If circular dependency, too many iterations.
|
297
|
+
"""
|
298
|
+
paths: LStr = []
|
299
|
+
|
300
|
+
idx = 0
|
301
|
+
dependency_: DLStr = dependency if dependency else DEPENDENT_MODELS
|
302
|
+
dependency_ = deepcopy(dependency_)
|
303
|
+
|
304
|
+
while dependency_:
|
305
|
+
for parent, children in dependency_.items():
|
306
|
+
if parent in paths:
|
307
|
+
continue
|
308
|
+
diff = set(children).difference(set(paths))
|
309
|
+
if parent == "dcim/devices":
|
310
|
+
diff.discard("dcim/virtual-chassis")
|
311
|
+
if not diff:
|
312
|
+
paths.append(parent)
|
313
|
+
|
314
|
+
dependency_ = {k: v for k, v in dependency_.items() if k not in paths}
|
315
|
+
if not dependency_:
|
316
|
+
break
|
317
|
+
|
318
|
+
idx += 1
|
319
|
+
if idx >= 100:
|
320
|
+
raise ValueError("Circular dependency, too many iterations")
|
321
|
+
|
322
|
+
return paths
|
323
|
+
|
14
324
|
|
15
325
|
# =========================== app model id ===========================
|
16
326
|
|
@@ -117,7 +117,7 @@ class NbParser:
|
|
117
117
|
|
118
118
|
:param keys: Chaining dictionary keys to retrieve the desired value.
|
119
119
|
|
120
|
-
:return: Boolean value or
|
120
|
+
:return: Boolean value or False if the value is absent.
|
121
121
|
:rtype: bool
|
122
122
|
"""
|
123
123
|
return self._get_keys(type_=bool, keys=keys, data=self.data)
|
@@ -1,16 +1,17 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "nbforager"
|
3
|
-
version = "0.
|
3
|
+
version = "0.8.0"
|
4
4
|
description = "Python package designed to assist in working with the Netbox REST API. The filter parameters are identical to those in the Web UI filter form. It replaces brief data with full information, and Netbox objects are represented as a recursive multidimensional dictionary."
|
5
5
|
authors = ["Vladimirs Prusakovs <vladimir.prusakovs@gmail.com>"]
|
6
6
|
readme = "README.rst"
|
7
|
+
package-mode = true
|
7
8
|
license = "Apache-2.0"
|
8
9
|
keywords = ["netbox"]
|
9
10
|
classifiers = [
|
10
11
|
"Development Status :: 5 - Production/Stable",
|
11
12
|
"Intended Audience :: Developers",
|
12
13
|
"License :: OSI Approved :: Apache Software License",
|
13
|
-
"Programming Language :: Python :: 3.
|
14
|
+
"Programming Language :: Python :: 3.11",
|
14
15
|
"Natural Language :: English",
|
15
16
|
]
|
16
17
|
|
@@ -18,18 +19,17 @@ classifiers = [
|
|
18
19
|
homepage = "https://github.com/vladimirs-git/nbforager"
|
19
20
|
repository = "https://github.com/vladimirs-git/nbforager"
|
20
21
|
"Bug Tracker" = "https://github.com/vladimirs-git/nbforager/issues"
|
21
|
-
"Download URL" = "https://github.com/vladimirs-git/nbforager/archive/refs/tags/0.
|
22
|
+
"Download URL" = "https://github.com/vladimirs-git/nbforager/archive/refs/tags/0.8.0.tar.gz"
|
22
23
|
|
23
24
|
[tool.poetry.dependencies]
|
24
|
-
python = "^3.
|
25
|
+
python = "^3.11"
|
25
26
|
#
|
26
27
|
ciscoconfparse = "^1.9"
|
27
|
-
netports = ">=0.
|
28
|
+
netports = ">=0.17"
|
28
29
|
pydantic = "^2"
|
29
30
|
requests = "^2"
|
30
|
-
tabulate = "^0.9
|
31
|
-
|
32
|
-
vhelpers = ">=0.3,<1.0.0"
|
31
|
+
tabulate = "^0.9"
|
32
|
+
vhelpers = ">=0.3"
|
33
33
|
|
34
34
|
[tool.poetry.group.test.dependencies]
|
35
35
|
dictdiffer = "^0.9.0"
|
@@ -44,30 +44,28 @@ sphinx-rtd-theme = "^1.3.0"
|
|
44
44
|
sphinxnotes-strike = "^1.2"
|
45
45
|
|
46
46
|
[tool.poetry.group.dev.dependencies]
|
47
|
-
poetry = "^1.
|
47
|
+
poetry = "^2.1.2"
|
48
48
|
#
|
49
|
-
mypy = "^1.
|
50
|
-
pygments = "^2.
|
51
|
-
pylint = "^3.
|
52
|
-
pytest-cov = "^
|
49
|
+
mypy = "^1.15.0"
|
50
|
+
pygments = "^2.19.1" # rst-lint
|
51
|
+
pylint = "^3.3.6"
|
52
|
+
pytest-cov = "^6.1.1"
|
53
53
|
restructuredtext-lint = "^1.4.0"
|
54
|
-
ruff = "^0.
|
55
|
-
twine = "^
|
56
|
-
types-pyyaml = "^6.0.12.12"
|
57
|
-
types-requests = "^2.
|
58
|
-
types-tabulate = "^0.9.0.
|
59
|
-
typing-extensions = "^4.
|
60
|
-
|
61
|
-
[tool.setuptools.package-data]
|
62
|
-
nbforager = ["py.typed"]
|
54
|
+
ruff = "^0.11.4"
|
55
|
+
twine = "^6.1.0"
|
56
|
+
#types-pyyaml = "^6.0.12.12"
|
57
|
+
types-requests = "^2.32.0.20250328"
|
58
|
+
types-tabulate = "^0.9.0.20241207"
|
59
|
+
typing-extensions = "^4.9.0"
|
63
60
|
|
64
61
|
[tool.poetry.extras]
|
65
62
|
test = ["pytest"]
|
66
63
|
|
67
64
|
[tool.pylint]
|
68
|
-
disable = "fixme"
|
65
|
+
#disable = "fixme"
|
69
66
|
max-args = 10
|
70
67
|
max-attributes = 10
|
68
|
+
max-bool-expr = 10
|
71
69
|
max-line-length = 100
|
72
70
|
max-locals = 20
|
73
71
|
max-nested-blocks = 6
|
@@ -84,13 +82,14 @@ disable = [
|
|
84
82
|
"protected-access",
|
85
83
|
"redefined-builtin",
|
86
84
|
"redefined-outer-name",
|
85
|
+
"too-many-positional-arguments",
|
87
86
|
"too-many-statements",
|
88
87
|
"unused-import",
|
89
88
|
"use-dict-literal",
|
90
89
|
]
|
91
90
|
|
92
91
|
[tool.mypy]
|
93
|
-
python_version = "3.
|
92
|
+
python_version = "3.11"
|
94
93
|
exclude = ["_notes"]
|
95
94
|
|
96
95
|
[[tool.mypy.overrides]]
|
@@ -107,17 +106,20 @@ exclude = [
|
|
107
106
|
"_notes",
|
108
107
|
"dist",
|
109
108
|
"examples",
|
109
|
+
"sdist",
|
110
110
|
"temp",
|
111
111
|
"tmp",
|
112
112
|
"venv",
|
113
113
|
]
|
114
114
|
line-length = 100
|
115
115
|
indent-width = 4
|
116
|
-
target-version = "
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
#
|
116
|
+
target-version = "py311"
|
117
|
+
|
118
|
+
[tool.ruff.lint.per-file-ignores]
|
119
|
+
"tests/*" = [
|
120
|
+
"F401", # imported but unused
|
121
|
+
"F811", # Redefinition of unused
|
122
|
+
]
|
121
123
|
|
122
124
|
[tool.ruff.format]
|
123
125
|
quote-style = "double"
|
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
|