Skip to content

Commit cefa018

Browse files
committed
remove RST directives from docstrings
1 parent d146b5f commit cefa018

22 files changed

Lines changed: 381 additions & 581 deletions

File tree

src/compas/__init__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,12 @@ def get(filename):
168168
The ``compas.get`` function is meant to be used in combination with the static
169169
constructors of the data structures.
170170
171-
.. code-block:: python
171+
```python
172+
import compas
173+
from compas.datastructures import Mesh
172174
173-
import compas
174-
from compas.datastructures import Mesh
175-
176-
mesh = Mesh.from_obj(compas.get("faces.obj"))
175+
mesh = Mesh.from_obj(compas.get("faces.obj"))
176+
```
177177
178178
"""
179179
filename = filename.strip("/")
@@ -210,12 +210,12 @@ def get_bunny(localstorage=None):
210210
Therefore, the returned path should be used in combination with the ``PLY``
211211
file reader, or with the ``from_ply`` constructor function for meshes.
212212
213-
.. code-block:: python
214-
215-
import compas
216-
from compas.datastructures import Mesh
213+
```python
214+
import compas
215+
from compas.datastructures import Mesh
217216
218-
mesh = Mesh.from_ply(compas.get_bunny())
217+
mesh = Mesh.from_ply(compas.get_bunny())
218+
```
219219
220220
"""
221221
import tarfile

src/compas/geometry/_core/_algebra.py

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2227,12 +2227,12 @@ def matrix_from_basis_vectors(xaxis, yaxis):
22272227
22282228
Notes
22292229
-----
2230-
.. code-block:: none
2231-
2232-
[ x0 y0 z0 0 ]
2233-
[ x1 y1 z1 0 ]
2234-
[ x2 y2 z2 0 ]
2235-
[ 0 0 0 1 ]
2230+
```
2231+
[ x0 y0 z0 0 ]
2232+
[ x1 y1 z1 0 ]
2233+
[ x2 y2 z2 0 ]
2234+
[ 0 0 0 1 ]
2235+
```
22362236
22372237
Examples
22382238
--------
@@ -2306,12 +2306,12 @@ def matrix_from_translation(translation):
23062306
23072307
Notes
23082308
-----
2309-
.. code-block:: none
2310-
2311-
[ . . . 0 ]
2312-
[ . . . 1 ]
2313-
[ . . . 2 ]
2314-
[ . . . . ]
2309+
```
2310+
[ . . . 0 ]
2311+
[ . . . 1 ]
2312+
[ . . . 2 ]
2313+
[ . . . . ]
2314+
```
23152315
23162316
Examples
23172317
--------
@@ -2472,12 +2472,12 @@ def matrix_from_perspective_entries(perspective):
24722472
24732473
Notes
24742474
-----
2475-
.. code-block:: none
2476-
2477-
[ . . . . ]
2478-
[ . . . . ]
2479-
[ . . . . ]
2480-
[ 0 1 2 3 ]
2475+
```
2476+
[ . . . . ]
2477+
[ . . . . ]
2478+
[ . . . . ]
2479+
[ 0 1 2 3 ]
2480+
```
24812481
24822482
"""
24832483
M = identity_matrix(4)
@@ -2503,12 +2503,12 @@ def matrix_from_shear_entries(shear_entries):
25032503
25042504
Notes
25052505
-----
2506-
.. code-block:: none
2507-
2508-
[ . 0 1 . ]
2509-
[ . . 2 . ]
2510-
[ . . . . ]
2511-
[ . . . . ]
2506+
```
2507+
[ . 0 1 . ]
2508+
[ . . 2 . ]
2509+
[ . . . . ]
2510+
[ . . . . ]
2511+
```
25122512
25132513
Examples
25142514
--------
@@ -2597,12 +2597,12 @@ def matrix_from_scale_factors(scale_factors):
25972597
25982598
Notes
25992599
-----
2600-
.. code-block:: python
2601-
2602-
[ 0 . . . ]
2603-
[ . 1 . . ]
2604-
[ . . 2 . ]
2605-
[ . . . . ]
2600+
```
2601+
[ 0 . . . ]
2602+
[ . 1 . . ]
2603+
[ . . 2 . ]
2604+
[ . . . . ]
2605+
```
26062606
26072607
Examples
26082608
--------

src/compas/rpc/server.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,25 @@ class Server(SimpleXMLRPCServer):
2020
2121
Examples
2222
--------
23-
.. code-block:: python
23+
```python
24+
# service.py
2425
25-
# service.py
26+
from compas.rpc import Server
27+
from compas.rpc import Dispatcher
2628
27-
from compas.rpc import Server
28-
from compas.rpc import Dispatcher
2929
30+
class DefaultService(Dispatcher):
31+
pass
3032
31-
class DefaultService(Dispatcher):
32-
pass
3333
34+
if __name__ == "__main__":
35+
server = Server(("localhost", 8888))
3436
35-
if __name__ == "__main__":
36-
server = Server(("localhost", 8888))
37-
38-
server.register_function(server.ping)
39-
server.register_function(server.remote_shutdown)
40-
server.register_instance(DefaultService())
41-
server.serve_forever()
37+
server.register_function(server.ping)
38+
server.register_function(server.remote_shutdown)
39+
server.register_instance(DefaultService())
40+
server.serve_forever()
41+
```
4242
4343
"""
4444

src/compas/utilities/azync.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,23 @@ def await_callback(async_func, callback_name="callback", errback_name=None, *arg
7373
The following example shows how to await an async function (``do_async_stuff`` in
7474
the example), using this utility:
7575
76-
.. code-block:: python
76+
```python
77+
from compas.utilities import await_callback
7778
78-
from compas.utilities import await_callback
7979
80+
def do_async_stuff(callback):
81+
from threading import Thread
8082
81-
def do_async_stuff(callback):
82-
from threading import Thread
83+
def runner(cb):
84+
print("doing async stuff")
85+
# ..
86+
cb("done")
8387
84-
def runner(cb):
85-
print("doing async stuff")
86-
# ..
87-
cb("done")
88+
Thread(target=runner, args=(callback,)).start()
8889
89-
Thread(target=runner, args=(callback,)).start()
9090
91-
92-
result = await_callback(do_async_stuff)
91+
result = await_callback(do_async_stuff)
92+
```
9393
9494
"""
9595
wait_event = threading.Event()

src/compas/utilities/decorators.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ def print_profile(func):
104104
105105
Examples
106106
--------
107-
.. code-block:: python
108-
109-
@print_profile
110-
def f(n):
111-
return sum(for i in range(n))
112-
113-
print(f(100))
114-
print(f.__doc__)
115-
print(f.__name__)
107+
```python
108+
@print_profile
109+
def f(n):
110+
return sum(for i in range(n))
111+
112+
print(f(100))
113+
print(f.__doc__)
114+
print(f.__name__)
115+
```
116116
117117
"""
118118

src/compas/utilities/remote.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ def download_file_from_remote(source, target, overwrite=True):
2424
2525
Examples
2626
--------
27-
.. code-block:: python
27+
```python
28+
import os
29+
import compas
30+
from compas.utilities.remote import download_file_from_remote
2831
29-
import os
30-
import compas
31-
from compas.utilities.remote import download_file_from_remote
32+
source = "https://raw.githubusercontent.com/compas-dev/compas/main/data/faces.obj"
33+
target = os.path.join(compas.APPDATA, "data", "faces.obj")
3234
33-
source = "https://raw.githubusercontent.com/compas-dev/compas/main/data/faces.obj"
34-
target = os.path.join(compas.APPDATA, "data", "faces.obj")
35-
36-
download_file_from_remote(source, target)
35+
download_file_from_remote(source, target)
36+
```
3737
3838
"""
3939
parent = os.path.abspath(os.path.dirname(target))

src/compas_blender/install.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ def install(version=None, packages=None, clean=False):
2828
2929
Examples
3030
--------
31-
.. code-block:: python
31+
```python
32+
import compas_blender.install
3233
33-
import compas_blender.install
34+
compas_blender.install.install()
35+
```
3436
35-
compas_blender.install.install()
36-
37-
.. code-block:: bash
38-
39-
python -m compas_blender.install
37+
```bash
38+
python -m compas_blender.install
39+
```
4040
4141
"""
4242
version = compas_blender._check_blender_version(version)

0 commit comments

Comments
 (0)