Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the properties that were incorrectly marked as methods in Qiskit 0.24-0.28 #1387

Merged
merged 6 commits into from
May 15, 2024

Conversation

arnaucasau
Copy link
Collaborator

Closes #1352

We have 18989 misclassified properties across different versions of Qiskit (0.24 - 0.28). To fix them, this PR added an early return to the getApiType() to return the correct apyType in case a member has the property modifier.

This is an example of the HTML of a property:

<dl class="py method">
<dt id="qiskit.circuit.Measure.definition">
<em class="property">property </em><code class="sig-name descname">definition</code><a class="headerlink" href="#qiskit.circuit.Measure.definition" title="Permalink to this definition"></a></dt>
<dd><p>Return definition in terms of other basic gates.</p>
</dd></dl>

The script searches for the property modifier inside the <dt> tag inside the <dl> tag.

@qiskit-bot
Copy link
Contributor

Thanks for contributing to Qiskit documentation!

Before your PR can be merged, it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. Thanks! 🙌

@@ -117,7 +117,7 @@ function prepareProps(
// Remove the attributes and properties modifiers as we don't show their signatures,
// but we still use them to create their headers
if (apiType == "attribute" || apiType == "property") {
findByText($, $main, "em.property", apiType).remove();
findByText($, $child, "em.property", apiType).remove();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is to restrict the search to the signature node. Before we were searching in the whole DOM which should be slower. Tested regenerating some historical versions (not all of them) as well as qiskit 1.0 and the dev version.

Copy link
Collaborator

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, so the properties were already in the right section of the file (## Attributes vs ## Methods).

Neat fix! Thanks for doing this.

@arnaucasau
Copy link
Collaborator Author

Actually, they are not in any section. For historical versions, both methods and attributes are all together alphabetically sorted (not sure if that happens always). I think the right ToC is a little confusing there because we assign an <h3> as the maximum header, and Methods and Attributes are <h2>s

Here is an example of that: https://docs.quantum.ibm.com/api/qiskit/0.24/qiskit.aqua.QuantumInstance#assemble

@Eric-Arellano
Copy link
Collaborator

Good point! I opened #1388 and #1389.

@arnaucasau arnaucasau added this pull request to the merge queue May 15, 2024
Merged via the queue into Qiskit:main with commit 6071904 May 15, 2024
5 checks passed
@arnaucasau arnaucasau deleted the AC/fix-properties branch May 15, 2024 16:19
frankharkins pushed a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
…0.24-0.28 (Qiskit#1387)

Closes Qiskit#1352

We have 18989 misclassified properties across different versions of
Qiskit (0.24 - 0.28). To fix them, this PR added an early return to the
`getApiType()` to return the correct `apyType` in case a member has the
property modifier.

This is an example of the HTML of a property:

```html
<dl class="py method">
<dt id="qiskit.circuit.Measure.definition">
<em class="property">property </em><code class="sig-name descname">definition</code><a class="headerlink" href="#qiskit.circuit.Measure.definition" title="Permalink to this definition">¶</a></dt>
<dd><p>Return definition in terms of other basic gates.</p>
</dd></dl>
```

The script searches for the `property` modifier inside the `<dt>` tag
inside the `<dl>` tag.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Properties incorrectly being marked as functions
3 participants