jedi: add new pybricks_jedi package

This package will be used in Pybricks Code to provide some intellesense
operations.
This commit is contained in:
David Lechner
2022-06-24 14:52:45 -05:00
parent 6d0de1effa
commit a2d9c33eb5
27 changed files with 2211 additions and 208 deletions
+13 -1
View File
@@ -27,6 +27,9 @@ from docutils import nodes
from docutils.parsers.rst.directives import flag
from docutils.parsers.rst import Directive
from sphinx.application import Sphinx
from sphinx.addnodes import pending_xref
from sphinx.environment import BuildEnvironment
from sphinx.util.nodes import make_refnode
import toml
TOP_DIR = os.path.abspath(os.path.join("..", ".."))
@@ -307,7 +310,16 @@ class AvailabilityDirective(Directive):
]
def on_missing_reference(app, env, node, contnode):
def on_missing_reference(
app: Sphinx, env: BuildEnvironment, node: pending_xref, contnode: nodes.Element
) -> nodes.Element:
# The Number type alias is on the Signals and Units page instead of on the
# pybricks.parameters page so normal resolution doesn't work
if node["reftype"] == "class" and node["reftarget"] == "Number":
return make_refnode(
app.builder, node["refdoc"], "signaltypes", "numbers", contnode
)
# References with special characters can't exist, so we have to supress
# warnings when Sphinx tries to cross reference units like deg/s. For
# consistency, we also treat units without special characters this way.
+3
View File
@@ -25,6 +25,9 @@ latex_logo = "../common/images/pybricks-logo-large.png"
if os.environ.get("READTHEDOCS", None) == "True":
tags.add("main") # noqa F821
# HACK: this allows Number type alias to be imported by Sphinx
os.environ["SPHINX_BUILD"] = "True"
# Addtional configuration of the IDE docs
if "ide" in tags.tags: # noqa F821
_DISCLAIMER = ""
+2 -16
View File
@@ -7,22 +7,8 @@ quantities. This page gives an overview of each quantity and its unit.
Numbers
~~~~~~~
.. class:: Number
Numbers can be represented as integers or floating point values:
* Integers (:class:`int <ubuiltins.int>`) are whole numbers
like ``15`` or ``-123``.
* Floating point values (:class:`float <ubuiltins.float>`) are decimal
numbers like ``3.14`` or ``-123.45``.
If you see :class:`Number <Number>` as the argument type, both
:class:`int <ubuiltins.int>` and :class:`float <ubuiltins.float>` may be used.
For example, :func:`wait(15) <pybricks.tools.wait>` and
:func:`wait(15.75) <pybricks.tools.wait>` are both allowed. In most functions,
however, your input value will be truncated to a whole number anyway. In this
example, either command makes the program pause for just 15 milliseconds.
.. autodata:: pybricks.parameters.Number
:noindex:
Time
~~~~~~