-
Notifications
You must be signed in to change notification settings - Fork 189
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
Add proper cross-references in docs. #1101
Changes from all commits
9e97c56
79b62cf
0e20e52
e0d7163
670b3aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,6 @@ __pycache__/ | |
/dataset_db.pyon | ||
/device_db*.py | ||
/test* | ||
|
||
# Pycharm/Jetbrains Development | ||
.idea/ | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -230,7 +230,7 @@ def build(self): | |
instead: when the repository is scanned to build the list of | ||
available experiments and when the dataset browser ``artiq_browser`` | ||
is used to open or run the analysis stage of an experiment. Do not | ||
rely on being able to operate on devices or arguments in ``build()``. | ||
rely on being able to operate on devices or arguments in :meth:`build`. | ||
|
||
Datasets are read-only in this method. | ||
|
||
|
@@ -277,7 +277,7 @@ def get_device(self, key): | |
|
||
def setattr_device(self, key): | ||
"""Sets a device driver as attribute. The names of the device driver | ||
and of the attribute are the same. | ||
and of the attribute are the same. | ||
|
||
The key is added to the instance's kernel invariants.""" | ||
setattr(self, key, self.get_device(key)) | ||
|
@@ -328,8 +328,10 @@ def get_dataset(self, key, default=NoDefault, archive=True): | |
By default, datasets obtained by this method are archived into the output | ||
HDF5 file of the experiment. If an archived dataset is requested more | ||
than one time (and therefore its value has potentially changed) or is | ||
modified, a warning is emitted. Archival can be turned off by setting | ||
the ``archive`` argument to ``False``. | ||
modified, a warning is emitted. | ||
|
||
:param archive: Set to ``False`` to turn off archiving datasets obtained | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Set to |
||
by this method into the experiment's output HDF5 file. Default is ``True`` | ||
""" | ||
try: | ||
return self.__dataset_mgr.get(key, archive) | ||
|
@@ -355,7 +357,7 @@ def prepare(self): | |
"""Entry point for pre-computing data necessary for running the | ||
experiment. | ||
|
||
Doing such computations outside of ``run`` enables more efficient | ||
Doing such computations outside of :meth:`run` enables more efficient | ||
scheduling of multiple experiments that need to access the shared | ||
hardware during part of their execution. | ||
|
||
|
@@ -371,8 +373,8 @@ def run(self): | |
|
||
This method may interact with the hardware. | ||
|
||
The experiment may call the scheduler's ``pause`` method while in | ||
``run``. | ||
The experiment may call the scheduler's :meth:`pause` method while in | ||
:meth:`run`. | ||
""" | ||
raise NotImplementedError | ||
|
||
|
@@ -382,7 +384,7 @@ def analyze(self): | |
This method may be overloaded by the user to implement the analysis | ||
phase of the experiment, for example fitting curves. | ||
|
||
Splitting this phase from ``run`` enables tweaking the analysis | ||
Splitting this phase from :meth:`run` enables tweaking the analysis | ||
algorithm on pre-existing data, and CPU-bound analyses to be run | ||
overlapped with the next experiment in a pipelined manner. | ||
|
||
|
@@ -392,13 +394,14 @@ def analyze(self): | |
|
||
|
||
class EnvExperiment(Experiment, HasEnvironment): | ||
"""Base class for top-level experiments that use the ``HasEnvironment`` | ||
environment manager. | ||
"""Base class for top-level experiments that use the | ||
:class:`~artiq.language.environment.HasEnvironment` environment manager. | ||
|
||
Most experiments should derive from this class.""" | ||
def prepare(self): | ||
"""The default prepare method calls prepare for all children, in the | ||
order of instantiation, if the child has a prepare method.""" | ||
"""This default prepare method calls :meth:`~artiq.language.environment.Experiment.prepare` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try to keep it < 80 chars line length. |
||
for all children, in the order of instantiation, if the child has a | ||
:meth:`~artiq.language.environment.Experiment.prepare` method.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And put the final """ onto a line by itself if the docstring is longer than one line. |
||
for child in self.children: | ||
if hasattr(child, "prepare"): | ||
child.prepare() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
""" | ||
This module provides a remote procedure call (RPC) mechanism over sockets | ||
between conventional computers (PCs) running Python. It strives to be | ||
transparent and uses ``artiq.protocols.pyon`` internally so that e.g. Numpy | ||
transparent and uses :mod:`artiq.protocols.pyon` internally so that e.g. Numpy | ||
arrays can be easily used. | ||
|
||
Note that the server operates on copies of objects provided by the client, | ||
|
@@ -61,18 +61,18 @@ class Client: | |
can be used as if they were local methods. | ||
|
||
For example, if the server provides method ``foo``, and ``c`` is a local | ||
``Client`` object, then the method can be called as: :: | ||
:class:`.Client` object, then the method can be called as: :: | ||
|
||
result = c.foo(param1, param2) | ||
|
||
The parameters and the result are automatically transferred with the | ||
The parameters and the result are automatically transferred from the | ||
server. | ||
|
||
Only methods are supported. Attributes must be accessed by providing and | ||
using "get" and/or "set" methods on the server side. | ||
|
||
At object initialization, the connection to the remote server is | ||
automatically attempted. The user must call ``close_rpc`` to | ||
automatically attempted. The user must call :meth:`~artiq.protocols.pc_rpc.Client.close_rpc` to | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line length. |
||
free resources properly after initialization completes successfully. | ||
|
||
:param host: Identifier of the server. The string can represent a | ||
|
@@ -81,11 +81,11 @@ class Client: | |
:param port: TCP port to use. | ||
:param target_name: Target name to select. ``IncompatibleServer`` is | ||
raised if the target does not exist. | ||
Use ``AutoTarget`` for automatic selection if the server has only one | ||
Use :class:`.AutoTarget` for automatic selection if the server has only one | ||
target. | ||
Use ``None`` to skip selecting a target. The list of targets can then | ||
be retrieved using ``get_rpc_id`` and then one can be selected later | ||
using ``select_rpc_target``. | ||
be retrieved using :meth:`~artiq.protocols.pc_rpc.Client.get_rpc_id` | ||
and then one can be selected later using :meth:`~artiq.protocols.pc_rpc.Client.select_rpc_target`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line length. |
||
:param timeout: Socket operation timeout. Use ``None`` for blocking | ||
(default), ``0`` for non-blocking, and a finite value to raise | ||
``socket.timeout`` if an operation does not complete within the | ||
|
@@ -198,7 +198,7 @@ def __init__(self): | |
|
||
async def connect_rpc(self, host, port, target_name): | ||
"""Connects to the server. This cannot be done in __init__ because | ||
this method is a coroutine. See ``Client`` for a description of the | ||
this method is a coroutine. See :class:`artiq.protocols.pc_rpc.Client` for a description of the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line length. |
||
parameters.""" | ||
self.__reader, self.__writer = \ | ||
await asyncio.open_connection(host, port, limit=100*1024*1024) | ||
|
@@ -447,7 +447,8 @@ def __str__(self): | |
|
||
class Server(_AsyncioServer): | ||
"""This class creates a TCP server that handles requests coming from | ||
``Client`` objects. | ||
*Client* objects (whether :class:`.Client`, :class:`.BestEffortClient`, | ||
or :class:`.AsyncioClient`). | ||
|
||
The server is designed using ``asyncio`` so that it can easily support | ||
multiple connections without the locking issues that arise in | ||
|
@@ -591,7 +592,7 @@ def simple_server_loop(targets, host, port, description=None): | |
"""Runs a server until an exception is raised (e.g. the user hits Ctrl-C) | ||
or termination is requested by a client. | ||
|
||
See ``Server`` for a description of the parameters. | ||
See :class:`artiq.protocols.pc_rpc.Server` for a description of the parameters. | ||
""" | ||
loop = asyncio.get_event_loop() | ||
try: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't. You want to have those in your personal gitignore and not add everyone's favorite editor's temp files to every project.