py2docfx 0.1.17.dev2139007__py3-none-any.whl → 0.1.17.dev2143539__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.
@@ -29,7 +29,7 @@ def missing_reference(app, env, node, contnode):
29
29
  else:
30
30
  fields = (module, node['py:class'], reftarget)
31
31
 
32
- if not is_built_in_type(reftarget):
32
+ if not is_built_in_type(reftarget , node):
33
33
  reftarget = '.'.join(
34
34
  field for field in fields if field is not None)
35
35
 
@@ -138,14 +138,19 @@ def is_typing(node_text: str, node) -> bool:
138
138
  # check if the node_text is a simple type name or has form of 'typing.TypeName'
139
139
  typing_prefix = 'typing.'
140
140
  check_typing_str = typing_prefix + node_text.strip()
141
- if 'refid' in node.attributes:
142
- is_shorten_type_name = check_shorten_type_name(node["refid"])
143
- temp_str = node["refid"]
141
+
142
+ def check_shorten_name_and_typing_str(node, attr_str):
143
+ is_shorten_type_name = check_shorten_type_name(node[attr_str])
144
+ temp_str = node[attr_str]
144
145
  has_typing_in_node_attributes = check_typing_str == temp_str.strip()
146
+ return is_shorten_type_name, has_typing_in_node_attributes
147
+
148
+ if 'refid' in node.attributes:
149
+ is_shorten_type_name, has_typing_in_node_attributes = check_shorten_name_and_typing_str(node, 'refid')
145
150
  elif 'refuri' in node.attributes:
146
- is_shorten_type_name = check_shorten_type_name(node["refuri"])
147
- temp_str = node["refuri"]
148
- has_typing_in_node_attributes = check_typing_str == temp_str.strip()
151
+ is_shorten_type_name, has_typing_in_node_attributes = check_shorten_name_and_typing_str(node, 'refuri')
152
+ elif 'reftarget' in node.attributes:
153
+ is_shorten_type_name, has_typing_in_node_attributes = check_shorten_name_and_typing_str(node, 'reftarget')
149
154
  else:
150
155
  has_typing_in_node_attributes = False
151
156
 
@@ -159,6 +164,13 @@ def is_typing(node_text: str, node) -> bool:
159
164
  def is_system_type(name: str) -> bool:
160
165
  return isclass(getattr(builtins, name, None))
161
166
 
167
+ def is_complex_type(node_text: str) -> bool:
168
+ complex_type_chars = ['[', ']', '(', ')']
169
+ for char in complex_type_chars:
170
+ if char in node_text:
171
+ return True
172
+ return False
173
+
162
174
  def process_complex_type(type_string: str) -> str:
163
175
  # replace "or" with ","
164
176
  type_string = type_string.replace(" or ", ",")
@@ -212,7 +224,7 @@ def extract_types(ret_data, skip_index_set = [], description_index = None):
212
224
  type_str += f'<xref:typing.{node_text}>'
213
225
  else:
214
226
  type_str += f'<xref:{node_text}>'
215
- elif ('[' in node_text) or (']' in node_text) or ('(' in node_text) or (')' in node_text):
227
+ elif is_complex_type(node_text):
216
228
  type_str += process_complex_type(node_text)
217
229
  else:
218
230
  if 'refid' in node.attributes:
@@ -47,5 +47,5 @@ def transform_node(app, node):
47
47
  writer.write(doc, destination)
48
48
  return destination.destination.decode('utf-8')
49
49
 
50
- def is_built_in_type(name: str) -> bool:
51
- return parameter_utils.is_system_type(name) or parameter_utils.is_typing(name)
50
+ def is_built_in_type(name: str, node) -> bool:
51
+ return parameter_utils.is_system_type(name) or parameter_utils.is_typing(name, node)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: py2docfx
3
- Version: 0.1.17.dev2139007
3
+ Version: 0.1.17.dev2143539
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
@@ -66,14 +66,14 @@ py2docfx/docfx_yaml/convert_module.py,sha256=GptO1MRwaQ2Qbu724F0kCDDQQTZe7mWOtrO
66
66
  py2docfx/docfx_yaml/convert_package.py,sha256=Ep7PmvoLInDvY6OU5dveR6iVwyzGRkW3q6lX7yGJ0JE,2109
67
67
  py2docfx/docfx_yaml/directives.py,sha256=zVVuNM_6AU9G6sbqL1UAyHHgPe7bkBWbthXI-PO5ez0,879
68
68
  py2docfx/docfx_yaml/logger.py,sha256=gz416vqSqmsD91qLOCLAzomczlCfWqGXFJFRzLlVbJE,6503
69
- py2docfx/docfx_yaml/miss_reference.py,sha256=Btoj9wAvA4u_wU7JHH0Cei3910N8a7MS34OUqJvXAd4,2443
69
+ py2docfx/docfx_yaml/miss_reference.py,sha256=NHoQtas0kvFsJXaR4fsk7kHjwV4aJobrr_Q30HaUc_I,2450
70
70
  py2docfx/docfx_yaml/nodes.py,sha256=tBDi35jLJArlobl07DKOkmH2qz7dudXLp_kTUfR_r2w,412
71
- py2docfx/docfx_yaml/parameter_utils.py,sha256=3qU_wf73Z24_FDxuTWD6IVWs9WQU0bJXSJ4Zyeg8_EQ,10417
71
+ py2docfx/docfx_yaml/parameter_utils.py,sha256=04wQCtbS-G2hWM5UGkL22s10LZLUbqbh3RM9rWGOToI,10897
72
72
  py2docfx/docfx_yaml/process_doctree.py,sha256=RUbq2DkkKl-KjKiuQrZhuvi8Q_ZjUdW4oi6CTWpMkxc,17229
73
73
  py2docfx/docfx_yaml/return_type_utils.py,sha256=nmdCUOvwdYk2jF6RqmOvU6gjXmXUTPUeCqyHPdKZNUQ,7483
74
74
  py2docfx/docfx_yaml/settings.py,sha256=JQZNwFebczl-zn8Yk2taAGANRi-Hw8hywtDWxqXXFyQ,373
75
75
  py2docfx/docfx_yaml/translator.py,sha256=LSzNl4C-07bLbUZ5myfyWwh25cTNIIBih77Cp4tBWvo,25999
76
- py2docfx/docfx_yaml/utils.py,sha256=m5jC_qP2NKqzUx_z0zgZ-HAmxQdNTpJYKkL_F9vGeII,1555
76
+ py2docfx/docfx_yaml/utils.py,sha256=sJ6aWF9wwIWIoZL6WWsd3FQD-zb3PWrJ5QTWP7PCarY,1567
77
77
  py2docfx/docfx_yaml/write_utils.py,sha256=q5qoYWw6GVDV8a3E8IxcSLWnN9sAer42VFRgadHBkgk,305
78
78
  py2docfx/docfx_yaml/writer.py,sha256=c_3s3KLbKJWRaafQgSK7P_8rs42RjB4nSBj9Mi4yA9g,35972
79
79
  py2docfx/docfx_yaml/yaml_builder.py,sha256=S3xty_ILxEUsw1J9VCwUkSLLYAUfQDm3fYbciv70gXc,2573
@@ -3913,7 +3913,7 @@ py2docfx/venv/venv1/Lib/site-packages/wheel/_commands/convert.py,sha256=0wSJMU0m
3913
3913
  py2docfx/venv/venv1/Lib/site-packages/wheel/_commands/pack.py,sha256=o3iwjfRHl7N9ul-M2kHbewLJZnqBLAWf0tzUCwoiTMw,3078
3914
3914
  py2docfx/venv/venv1/Lib/site-packages/wheel/_commands/tags.py,sha256=Rv2ySVb8-qX3osKp3uJgxcIMXkjt43XUD0-zvC6KvnY,4775
3915
3915
  py2docfx/venv/venv1/Lib/site-packages/wheel/_commands/unpack.py,sha256=Y_J7ynxPSoFFTT7H0fMgbBlVErwyDGcObgme5MBuz58,1021
3916
- py2docfx-0.1.17.dev2139007.dist-info/METADATA,sha256=RsOqcpYwQTZtjjnBmSM4bqLnhV0peDvCms4tNxFontc,548
3917
- py2docfx-0.1.17.dev2139007.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
3918
- py2docfx-0.1.17.dev2139007.dist-info/top_level.txt,sha256=5dH2uP81dczt_qQJ38wiZ-gzoVWasfiJALWRSjdbnYU,9
3919
- py2docfx-0.1.17.dev2139007.dist-info/RECORD,,
3916
+ py2docfx-0.1.17.dev2143539.dist-info/METADATA,sha256=FSXuDM4dVeQmWI9EWWOF7nTaNOL0eoqekS4jJHNB-TA,548
3917
+ py2docfx-0.1.17.dev2143539.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
3918
+ py2docfx-0.1.17.dev2143539.dist-info/top_level.txt,sha256=5dH2uP81dczt_qQJ38wiZ-gzoVWasfiJALWRSjdbnYU,9
3919
+ py2docfx-0.1.17.dev2143539.dist-info/RECORD,,