py2docfx 0.1.1.dev1626976__py3-none-any.whl → 0.1.1.dev1626977__py3-none-any.whl
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.
- py2docfx/convert_prepare/tests/test_generate_document.py +0 -1
- py2docfx/docfx_yaml/build_finished.py +25 -64
- {py2docfx-0.1.1.dev1626976.dist-info → py2docfx-0.1.1.dev1626977.dist-info}/METADATA +1 -1
- {py2docfx-0.1.1.dev1626976.dist-info → py2docfx-0.1.1.dev1626977.dist-info}/RECORD +6 -6
- {py2docfx-0.1.1.dev1626976.dist-info → py2docfx-0.1.1.dev1626977.dist-info}/WHEEL +0 -0
- {py2docfx-0.1.1.dev1626976.dist-info → py2docfx-0.1.1.dev1626977.dist-info}/top_level.txt +0 -0
@@ -51,5 +51,4 @@ def test_generate_document(tmp_path):
|
|
51
51
|
assert not os.path.exists(os.path.join(yaml_path, "azure.dummy.yml"))
|
52
52
|
assert not os.path.exists(os.path.join(yaml_path, "azure.yml"))
|
53
53
|
assert os.path.exists(os.path.join(yaml_path, "toc.yml"))
|
54
|
-
assert os.path.exists(os.path.join(yaml_path, "index.yml"))
|
55
54
|
|
@@ -32,18 +32,24 @@ def build_finished(app, exception):
|
|
32
32
|
"""
|
33
33
|
Output YAML on the file system.
|
34
34
|
"""
|
35
|
-
def
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
35
|
+
def insert_node_to_toc_tree(toc_yaml, uid, project_name, toc_node_map):
|
36
|
+
name = uid.split('.')[-1] if '.' in uid and project_name != uid else uid
|
37
|
+
cur_node = {'name': name, 'uid': uid}
|
38
|
+
|
39
|
+
# Build nested TOC
|
40
|
+
if uid.count('.') >= 1:
|
41
|
+
parent_level = '.'.join(uid.split('.')[:-1])
|
42
|
+
found_node = toc_node_map[parent_level] if parent_level in toc_node_map else None
|
43
|
+
if found_node:
|
44
|
+
if 'uid' in found_node:
|
45
|
+
found_node.pop('uid', 'No uid found')
|
46
|
+
found_node.setdefault('items', [{'name': 'Overview', 'uid': parent_level}]).append(cur_node)
|
47
|
+
else:
|
48
|
+
toc_yaml.append(cur_node)
|
49
|
+
else:
|
50
|
+
# if uid doesn't contain '.', the name needn't to simplify
|
51
|
+
toc_yaml.append(cur_node)
|
52
|
+
toc_node_map[uid] = cur_node
|
47
53
|
|
48
54
|
def convert_class_to_enum_if_needed(obj):
|
49
55
|
if (obj.get('inheritance'), None):
|
@@ -94,7 +100,8 @@ def build_finished(app, exception):
|
|
94
100
|
API_ROOT
|
95
101
|
))
|
96
102
|
ensuredir(normalized_outdir)
|
97
|
-
|
103
|
+
project_name = app.config.project.replace('-','.')
|
104
|
+
toc_node_map = {}
|
98
105
|
toc_yaml = []
|
99
106
|
# Used to record filenames dumped to avoid confliction
|
100
107
|
# caused by Windows case insensitive file system
|
@@ -103,8 +110,8 @@ def build_finished(app, exception):
|
|
103
110
|
# Order matters here, we need modules before lower level classes,
|
104
111
|
# so that we can make sure to inject the TOC properly
|
105
112
|
# put app.env.docfx_yaml_packages after app.env.docfx_yaml_modules to keep same TOC items order
|
106
|
-
for data_set in (app.env.
|
107
|
-
app.env.
|
113
|
+
for data_set in (app.env.docfx_yaml_packages,
|
114
|
+
app.env.docfx_yaml_modules,
|
108
115
|
app.env.docfx_yaml_classes,
|
109
116
|
app.env.docfx_yaml_functions): # noqa
|
110
117
|
|
@@ -212,20 +219,7 @@ def build_finished(app, exception):
|
|
212
219
|
if (obj['type'] == 'class' and obj['inheritance']):
|
213
220
|
convert_class_to_enum_if_needed(obj)
|
214
221
|
|
215
|
-
|
216
|
-
if uid.count('.') >= 1:
|
217
|
-
parent_level = '.'.join(uid.split('.')[:-1])
|
218
|
-
found_node = find_node_in_toc_tree(toc_yaml, parent_level)
|
219
|
-
|
220
|
-
if found_node:
|
221
|
-
found_node.pop('uid', 'No uid found')
|
222
|
-
found_node.setdefault('items', [{'name': 'Overview', 'uid': parent_level}]).append(
|
223
|
-
{'name': uid, 'uid': uid})
|
224
|
-
else:
|
225
|
-
toc_yaml.append({'name': uid, 'uid': uid})
|
226
|
-
|
227
|
-
else:
|
228
|
-
toc_yaml.append({'name': uid, 'uid': uid})
|
222
|
+
insert_node_to_toc_tree(toc_yaml, uid, project_name, toc_node_map)
|
229
223
|
|
230
224
|
for data_set in (app.env.docfx_yaml_packages,
|
231
225
|
app.env.docfx_yaml_modules,
|
@@ -272,41 +266,8 @@ def build_finished(app, exception):
|
|
272
266
|
with open(toc_file, 'w') as writable:
|
273
267
|
writable.write(
|
274
268
|
dump(
|
275
|
-
|
276
|
-
'name': app.config.project,
|
277
|
-
'items': [{'name': 'Overview', 'uid': 'project-' + app.config.project}] + toc_yaml
|
278
|
-
}],
|
269
|
+
toc_yaml,
|
279
270
|
default_flow_style=False,
|
280
271
|
)
|
281
272
|
)
|
282
|
-
|
283
|
-
index_file = os.path.join(normalized_outdir, 'index.yml')
|
284
|
-
index_children = []
|
285
|
-
index_references = []
|
286
|
-
for item in toc_yaml:
|
287
|
-
index_children.append(item.get('name', ''))
|
288
|
-
index_references.append({
|
289
|
-
'uid': item.get('name', ''),
|
290
|
-
'name': item.get('name', ''),
|
291
|
-
'fullname': item.get('name', ''),
|
292
|
-
'isExternal': False
|
293
|
-
})
|
294
|
-
|
295
|
-
index_obj = [{
|
296
|
-
'uid': 'project-' + app.config.project,
|
297
|
-
'name': app.config.project,
|
298
|
-
'fullName': app.config.project,
|
299
|
-
'langs': ['python'],
|
300
|
-
'type': 'package',
|
301
|
-
'kind': 'distribution',
|
302
|
-
'summary': '',
|
303
|
-
'children': index_children
|
304
|
-
}]
|
305
|
-
transformed_obj = convert_package(index_obj, app.env.docfx_info_uid_types)
|
306
|
-
mime = "PythonPackage"
|
307
|
-
if transformed_obj == None:
|
308
|
-
print("Unknown yml: " + yamlfile_path)
|
309
|
-
else:
|
310
|
-
# save file
|
311
|
-
common.write_yaml(transformed_obj, index_file, mime)
|
312
|
-
file_name_set.add(filename)
|
273
|
+
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: py2docfx
|
3
|
-
Version: 0.1.1.
|
3
|
+
Version: 0.1.1.dev1626977
|
4
4
|
Summary: A package built based on Sphinx which download source code package and generate yaml files supported by docfx.
|
5
5
|
Author: Microsoft Corporation
|
6
6
|
License: MIT License
|
@@ -22,7 +22,7 @@ py2docfx/convert_prepare/post_process/merge_toc.py,sha256=coyae54OB1nGcCkxz9oAu-
|
|
22
22
|
py2docfx/convert_prepare/subpackage_merge/merge_root_package.py,sha256=uK96qL2asuSfo_3SZaoP8XZaUvjf5mNkr17JNbZR4Lg,1026
|
23
23
|
py2docfx/convert_prepare/subpackage_merge/merge_toc.py,sha256=nkVqe8R0m8D6cyTYV7aIpMDXorvn4-LXfU_vIK_hJBg,1706
|
24
24
|
py2docfx/convert_prepare/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
|
-
py2docfx/convert_prepare/tests/test_generate_document.py,sha256=
|
25
|
+
py2docfx/convert_prepare/tests/test_generate_document.py,sha256=hOAtib9pTFaZCS8QbYS6Dhz0hNGESDHPXumRIuIWp4Y,2415
|
26
26
|
py2docfx/convert_prepare/tests/test_get_source.py,sha256=c22JfobgbEbWWiNzBNYpZm2yDfo5LwBioUuRwft9WZE,5858
|
27
27
|
py2docfx/convert_prepare/tests/test_pack.py,sha256=46JWMNzknIptDVs7D3CuxcmqBr_OKMmaw1br9H7wqco,4134
|
28
28
|
py2docfx/convert_prepare/tests/test_package_info.py,sha256=L2ax9dItnz5QNSsSjSjEcaS6UPZxiq3MwysBB1FdJxI,2262
|
@@ -52,7 +52,7 @@ py2docfx/convert_prepare/tests/data/subpackage/azure-mgmt-containerservice/azure
|
|
52
52
|
py2docfx/convert_prepare/tests/data/subpackage/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
53
53
|
py2docfx/convert_prepare/tests/data/subpackage/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
54
54
|
py2docfx/docfx_yaml/__init__.py,sha256=KCEizAXv-SXtrYhvFfLHdBWDhz51AA9uagaeTL-Itpo,100
|
55
|
-
py2docfx/docfx_yaml/build_finished.py,sha256=
|
55
|
+
py2docfx/docfx_yaml/build_finished.py,sha256=fOEWrL6uZR5pPJl6qBtMA-6YKVY_tMyDhYtizJT1958,12790
|
56
56
|
py2docfx/docfx_yaml/build_init.py,sha256=lAw-fnBVQbySfZ7Sut_NpFQUjnqLOmnGQrTBBH2RXcg,1860
|
57
57
|
py2docfx/docfx_yaml/common.py,sha256=Tl6OPSIcvPjFw1AvWt5Mun8pQr9NtUGQnk4zh474Py0,6316
|
58
58
|
py2docfx/docfx_yaml/convert_class.py,sha256=boKDaxnXbnLxja62UFXi3eChGDB_WBW6ouUUJgOhdpE,2098
|
@@ -112,7 +112,7 @@ py2docfx/docfx_yaml/tests/roots/test-writer-table/conf.py,sha256=avcbnIOV2mlGQwh
|
|
112
112
|
py2docfx/docfx_yaml/tests/roots/test-writer-uri/code_with_uri.py,sha256=bzWTZpY2yf_By2bOSl1GFaY3BsZpkAvwQuGztlcHKkQ,537
|
113
113
|
py2docfx/docfx_yaml/tests/roots/test-writer-uri/conf.py,sha256=avcbnIOV2mlGQwhMQJZC4W6UGRBRhnq1QBxjPWlySxQ,260
|
114
114
|
py2docfx/docfx_yaml/tests/utils/test_utils.py,sha256=d0OYSUQ6NyoZx5mlLdNGGNhiNmmQhjVT4hQ6jY3VE_M,3383
|
115
|
-
py2docfx-0.1.1.
|
116
|
-
py2docfx-0.1.1.
|
117
|
-
py2docfx-0.1.1.
|
118
|
-
py2docfx-0.1.1.
|
115
|
+
py2docfx-0.1.1.dev1626977.dist-info/METADATA,sha256=KBo1jSrTKyimTVC1JWsnfLlAhsBNlqGSj82D6XDmLY4,601
|
116
|
+
py2docfx-0.1.1.dev1626977.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
117
|
+
py2docfx-0.1.1.dev1626977.dist-info/top_level.txt,sha256=5dH2uP81dczt_qQJ38wiZ-gzoVWasfiJALWRSjdbnYU,9
|
118
|
+
py2docfx-0.1.1.dev1626977.dist-info/RECORD,,
|
File without changes
|
File without changes
|