Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/build/lib/pypcd/tests/__init__.py +0 -0
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/build/lib/pypcd/tests/test_pypcd.py +206 -0
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/dist/pypcd-0.1.1-py3.8.egg +0 -0
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/Makefile +184 -0
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/conf.py +284 -0
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/index.rst +22 -0
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/sphinxext/docscrape.py +570 -0
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/sphinxext/docscrape_sphinx.py +227 -0
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/sphinxext/github.py +155 -0
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/sphinxext/math_dollar.py +63 -0
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/sphinxext/numpydoc.py +203 -0
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/tools/LICENSE.txt +7 -0
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/tools/apigen.py +509 -0
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/tools/build_modref_templates.py +68 -0
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/pypcd.egg-info/PKG-INFO +41 -0
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/pypcd.egg-info/SOURCES.txt +17 -0
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/pypcd.egg-info/dependency_links.txt +1 -0
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/pypcd.egg-info/requires.txt +2 -0
- Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/pypcd.egg-info/top_level.txt +1 -0
- Annotated_Lidar/ntu_day_10/convert_pcd_2_npy.py +44 -0
- Annotated_Lidar/ntu_day_10/pose_inW.csv +0 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0033.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0061.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0070.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0087.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0097.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0098.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0100.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0165.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0246.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0267.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0302.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0307.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0354.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0356.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0366.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0367.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0372.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0403.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0447.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0469.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0475.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0489.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0514.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0529.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0580.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0639.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0646.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0656.npy +3 -0
- mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0659.npy +3 -0
Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/build/lib/pypcd/tests/__init__.py
ADDED
|
File without changes
|
Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/build/lib/pypcd/tests/test_pypcd.py
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
+
|
| 11 |
+
header1 = """\
|
| 12 |
+
# .PCD v0.7 - Point Cloud Data file format
|
| 13 |
+
VERSION 0.7
|
| 14 |
+
FIELDS x y z i
|
| 15 |
+
SIZE 4 4 4 4
|
| 16 |
+
TYPE F F F F
|
| 17 |
+
COUNT 1 1 1 1
|
| 18 |
+
WIDTH 500028
|
| 19 |
+
HEIGHT 1
|
| 20 |
+
VIEWPOINT 0 0 0 1 0 0 0
|
| 21 |
+
POINTS 500028
|
| 22 |
+
DATA binary_compressed
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
header2 = """\
|
| 26 |
+
VERSION .7
|
| 27 |
+
FIELDS x y z normal_x normal_y normal_z curvature boundary k vp_x vp_y vp_z principal_curvature_x principal_curvature_y principal_curvature_z pc1 pc2
|
| 28 |
+
SIZE 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
|
| 29 |
+
TYPE F F F F F F F F F F F F F F F F F
|
| 30 |
+
COUNT 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
| 31 |
+
WIDTH 19812
|
| 32 |
+
HEIGHT 1
|
| 33 |
+
VIEWPOINT 0.0 0.0 0.0 1.0 0.0 0.0 0.0
|
| 34 |
+
POINTS 19812
|
| 35 |
+
DATA ascii
|
| 36 |
+
"""
|
| 37 |
+
|
| 38 |
+
@pytest.fixture
|
| 39 |
+
def pcd_fname():
|
| 40 |
+
import pypcd
|
| 41 |
+
return os.path.join(pypcd.__path__[0], 'test_data',
|
| 42 |
+
'partial_cup_model.pcd')
|
| 43 |
+
|
| 44 |
+
@pytest.fixture
|
| 45 |
+
def ascii_pcd_fname():
|
| 46 |
+
import pypcd
|
| 47 |
+
return os.path.join(pypcd.__path__[0], 'test_data',
|
| 48 |
+
'ascii.pcd')
|
| 49 |
+
|
| 50 |
+
@pytest.fixture
|
| 51 |
+
def bin_pcd_fname():
|
| 52 |
+
import pypcd
|
| 53 |
+
return os.path.join(pypcd.__path__[0], 'test_data',
|
| 54 |
+
'bin.pcd')
|
| 55 |
+
|
| 56 |
+
def cloud_centroid(pc):
|
| 57 |
+
xyz = np.empty((pc.points, 3), dtype=float)
|
| 58 |
+
xyz[:,0] = pc.pc_data['x']
|
| 59 |
+
xyz[:,1] = pc.pc_data['y']
|
| 60 |
+
xyz[:,2] = pc.pc_data['z']
|
| 61 |
+
return xyz.mean(0)
|
| 62 |
+
|
| 63 |
+
def test_parse_header():
|
| 64 |
+
from pypcd.pypcd import parse_header
|
| 65 |
+
lines = header1.split('\n')
|
| 66 |
+
md = parse_header(lines)
|
| 67 |
+
assert (md['version'] == '0.7')
|
| 68 |
+
assert (md['fields'] == ['x', 'y', 'z', 'i'])
|
| 69 |
+
assert (md['size'] == [4, 4, 4, 4])
|
| 70 |
+
assert (md['type'] == ['F', 'F', 'F', 'F'])
|
| 71 |
+
assert (md['count'] == [1, 1, 1, 1])
|
| 72 |
+
assert (md['width'] == 500028)
|
| 73 |
+
assert (md['height'] == 1)
|
| 74 |
+
assert (md['viewpoint'] == [0, 0, 0, 1, 0, 0, 0])
|
| 75 |
+
assert (md['points'] == 500028)
|
| 76 |
+
assert (md['data'] == 'binary_compressed')
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
def test_from_path(pcd_fname):
|
| 80 |
+
from pypcd import pypcd
|
| 81 |
+
pc = pypcd.PointCloud.from_path(pcd_fname)
|
| 82 |
+
|
| 83 |
+
fields = 'x y z normal_x normal_y normal_z curvature boundary k vp_x vp_y vp_z principal_curvature_x principal_curvature_y principal_curvature_z pc1 pc2'.split()
|
| 84 |
+
for fld1, fld2 in zip(pc.fields, fields):
|
| 85 |
+
assert(fld1 == fld2)
|
| 86 |
+
assert (pc.width == 19812)
|
| 87 |
+
assert (len(pc.pc_data) == 19812)
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
def test_add_fields(pcd_fname):
|
| 91 |
+
from pypcd import pypcd
|
| 92 |
+
pc = pypcd.PointCloud.from_path(pcd_fname)
|
| 93 |
+
|
| 94 |
+
old_md = pc.get_metadata()
|
| 95 |
+
# new_dt = [(f, pc.pc_data.dtype[f]) for f in pc.pc_data.dtype.fields]
|
| 96 |
+
# new_data = [pc.pc_data[n] for n in pc.pc_data.dtype.names]
|
| 97 |
+
md = {'fields': ['bla', 'bar'], 'count': [1, 1], 'size': [4, 4],
|
| 98 |
+
'type': ['F', 'F']}
|
| 99 |
+
d = np.rec.fromarrays((np.random.random(len(pc.pc_data)),
|
| 100 |
+
np.random.random(len(pc.pc_data))))
|
| 101 |
+
newpc = pypcd.add_fields(pc, md, d)
|
| 102 |
+
|
| 103 |
+
new_md = newpc.get_metadata()
|
| 104 |
+
# print len(old_md['fields']), len(md['fields']), len(new_md['fields'])
|
| 105 |
+
# print old_md['fields'], md['fields'], new_md['fields']
|
| 106 |
+
assert(len(old_md['fields'])+len(md['fields']) == len(new_md['fields']))
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def test_path_roundtrip_ascii(pcd_fname):
|
| 110 |
+
from pypcd import pypcd
|
| 111 |
+
pc = pypcd.PointCloud.from_path(pcd_fname)
|
| 112 |
+
md = pc.get_metadata()
|
| 113 |
+
|
| 114 |
+
tmp_dirname = tempfile.mkdtemp(suffix='_pypcd', prefix='tmp')
|
| 115 |
+
|
| 116 |
+
tmp_fname = os.path.join(tmp_dirname, 'out.pcd')
|
| 117 |
+
|
| 118 |
+
pc.save_pcd(tmp_fname, compression='ascii')
|
| 119 |
+
|
| 120 |
+
assert(os.path.exists(tmp_fname))
|
| 121 |
+
|
| 122 |
+
pc2 = pypcd.PointCloud.from_path(tmp_fname)
|
| 123 |
+
md2 = pc2.get_metadata()
|
| 124 |
+
assert(md == md2)
|
| 125 |
+
|
| 126 |
+
np.testing.assert_equal(pc.pc_data, pc2.pc_data)
|
| 127 |
+
|
| 128 |
+
if os.path.exists(tmp_fname):
|
| 129 |
+
os.unlink(tmp_fname)
|
| 130 |
+
os.removedirs(tmp_dirname)
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
def test_path_roundtrip_binary(pcd_fname):
|
| 134 |
+
from pypcd import pypcd
|
| 135 |
+
pc = pypcd.PointCloud.from_path(pcd_fname)
|
| 136 |
+
md = pc.get_metadata()
|
| 137 |
+
|
| 138 |
+
tmp_dirname = tempfile.mkdtemp(suffix='_pypcd', prefix='tmp')
|
| 139 |
+
|
| 140 |
+
tmp_fname = os.path.join(tmp_dirname, 'out.pcd')
|
| 141 |
+
|
| 142 |
+
pc.save_pcd(tmp_fname, compression='binary')
|
| 143 |
+
|
| 144 |
+
assert(os.path.exists(tmp_fname))
|
| 145 |
+
|
| 146 |
+
pc2 = pypcd.PointCloud.from_path(tmp_fname)
|
| 147 |
+
md2 = pc2.get_metadata()
|
| 148 |
+
for k, v in md2.items():
|
| 149 |
+
if k == 'data':
|
| 150 |
+
assert v == 'binary'
|
| 151 |
+
else:
|
| 152 |
+
assert v == md[k]
|
| 153 |
+
|
| 154 |
+
np.testing.assert_equal(pc.pc_data, pc2.pc_data)
|
| 155 |
+
|
| 156 |
+
if os.path.exists(tmp_fname):
|
| 157 |
+
os.unlink(tmp_fname)
|
| 158 |
+
os.removedirs(tmp_dirname)
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
def test_path_roundtrip_binary_compressed(pcd_fname):
|
| 162 |
+
from pypcd import pypcd
|
| 163 |
+
pc = pypcd.PointCloud.from_path(pcd_fname)
|
| 164 |
+
md = pc.get_metadata()
|
| 165 |
+
|
| 166 |
+
tmp_dirname = tempfile.mkdtemp(suffix='_pypcd', prefix='tmp')
|
| 167 |
+
|
| 168 |
+
tmp_fname = os.path.join(tmp_dirname, 'out.pcd')
|
| 169 |
+
|
| 170 |
+
pc.save_pcd(tmp_fname, compression='binary_compressed')
|
| 171 |
+
|
| 172 |
+
assert(os.path.exists(tmp_fname))
|
| 173 |
+
|
| 174 |
+
pc2 = pypcd.PointCloud.from_path(tmp_fname)
|
| 175 |
+
md2 = pc2.get_metadata()
|
| 176 |
+
for k, v in md2.items():
|
| 177 |
+
if k == 'data':
|
| 178 |
+
assert v == 'binary_compressed'
|
| 179 |
+
else:
|
| 180 |
+
assert v == md[k]
|
| 181 |
+
|
| 182 |
+
np.testing.assert_equal(pc.pc_data, pc2.pc_data)
|
| 183 |
+
|
| 184 |
+
if os.path.exists(tmp_dirname):
|
| 185 |
+
shutil.rmtree(tmp_dirname)
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
def test_cat_pointclouds(pcd_fname):
|
| 189 |
+
from pypcd import pypcd
|
| 190 |
+
pc = pypcd.PointCloud.from_path(pcd_fname)
|
| 191 |
+
pc2 = pc.copy()
|
| 192 |
+
pc2.pc_data['x'] += 0.1
|
| 193 |
+
pc3 = pypcd.cat_point_clouds(pc, pc2)
|
| 194 |
+
for fld, fld3 in zip(pc.fields, pc3.fields):
|
| 195 |
+
assert(fld == fld3)
|
| 196 |
+
assert(pc3.width == pc.width+pc2.width)
|
| 197 |
+
|
| 198 |
+
def test_ascii_bin1(ascii_pcd_fname, bin_pcd_fname):
|
| 199 |
+
from pypcd import pypcd
|
| 200 |
+
apc1 = pypcd.point_cloud_from_path(ascii_pcd_fname)
|
| 201 |
+
bpc1 = pypcd.point_cloud_from_path(bin_pcd_fname)
|
| 202 |
+
am = cloud_centroid(apc1)
|
| 203 |
+
bm = cloud_centroid(bpc1)
|
| 204 |
+
assert( np.allclose(am, bm) )
|
| 205 |
+
|
| 206 |
+
|
Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/dist/pypcd-0.1.1-py3.8.egg
ADDED
|
Binary file (39.9 kB). View file
|
|
|
Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/Makefile
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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INXOPTS =
|
| 6 |
+
SPHINXBUILD = sphinx-build
|
| 7 |
+
PAPER =
|
| 8 |
+
BUILDDIR = _build
|
| 9 |
+
|
| 10 |
+
# User-friendly check for sphinx-build
|
| 11 |
+
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
|
| 12 |
+
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
|
| 13 |
+
endif
|
| 14 |
+
|
| 15 |
+
# Internal variables.
|
| 16 |
+
PAPEROPT_a4 = -D latex_paper_size=a4
|
| 17 |
+
PAPEROPT_letter = -D latex_paper_size=letter
|
| 18 |
+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
| 19 |
+
# the i18n builder cannot share the environment and doctrees with the others
|
| 20 |
+
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
| 21 |
+
|
| 22 |
+
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
| 23 |
+
|
| 24 |
+
help:
|
| 25 |
+
@echo "Please use \`make <target>' where <target> is one of"
|
| 26 |
+
@echo " html to make standalone HTML files"
|
| 27 |
+
@echo " dirhtml to make HTML files named index.html in directories"
|
| 28 |
+
@echo " singlehtml to make a single large HTML file"
|
| 29 |
+
@echo " pickle to make pickle files"
|
| 30 |
+
@echo " json to make JSON files"
|
| 31 |
+
@echo " htmlhelp to make HTML files and a HTML help project"
|
| 32 |
+
@echo " qthelp to make HTML files and a qthelp project"
|
| 33 |
+
@echo " devhelp to make HTML files and a Devhelp project"
|
| 34 |
+
@echo " epub to make an epub"
|
| 35 |
+
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
| 36 |
+
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
| 37 |
+
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
|
| 38 |
+
@echo " text to make text files"
|
| 39 |
+
@echo " man to make manual pages"
|
| 40 |
+
@echo " texinfo to make Texinfo files"
|
| 41 |
+
@echo " info to make Texinfo files and run them through makeinfo"
|
| 42 |
+
@echo " gettext to make PO message catalogs"
|
| 43 |
+
@echo " changes to make an overview of all changed/added/deprecated items"
|
| 44 |
+
@echo " xml to make Docutils-native XML files"
|
| 45 |
+
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
|
| 46 |
+
@echo " linkcheck to check all external links for integrity"
|
| 47 |
+
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
api:
|
| 51 |
+
@mkdir -p reference
|
| 52 |
+
$(PYTHON) tools/build_modref_templates.py pypcd reference
|
| 53 |
+
@echo "Build API docs...done."
|
| 54 |
+
|
| 55 |
+
clean:
|
| 56 |
+
rm -rf $(BUILDDIR)/*
|
| 57 |
+
rm -rf reference/*
|
| 58 |
+
|
| 59 |
+
html: api
|
| 60 |
+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
| 61 |
+
@echo
|
| 62 |
+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
| 63 |
+
|
| 64 |
+
dirhtml:
|
| 65 |
+
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
| 66 |
+
@echo
|
| 67 |
+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
| 68 |
+
|
| 69 |
+
singlehtml:
|
| 70 |
+
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
| 71 |
+
@echo
|
| 72 |
+
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
| 73 |
+
|
| 74 |
+
pickle:
|
| 75 |
+
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
| 76 |
+
@echo
|
| 77 |
+
@echo "Build finished; now you can process the pickle files."
|
| 78 |
+
|
| 79 |
+
json:
|
| 80 |
+
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
| 81 |
+
@echo
|
| 82 |
+
@echo "Build finished; now you can process the JSON files."
|
| 83 |
+
|
| 84 |
+
htmlhelp:
|
| 85 |
+
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
| 86 |
+
@echo
|
| 87 |
+
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
| 88 |
+
".hhp project file in $(BUILDDIR)/htmlhelp."
|
| 89 |
+
|
| 90 |
+
qthelp:
|
| 91 |
+
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
| 92 |
+
@echo
|
| 93 |
+
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
| 94 |
+
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
| 95 |
+
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pypcd.qhcp"
|
| 96 |
+
@echo "To view the help file:"
|
| 97 |
+
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pypcd.qhc"
|
| 98 |
+
|
| 99 |
+
devhelp:
|
| 100 |
+
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
| 101 |
+
@echo
|
| 102 |
+
@echo "Build finished."
|
| 103 |
+
@echo "To view the help file:"
|
| 104 |
+
@echo "# mkdir -p $$HOME/.local/share/devhelp/pypcd"
|
| 105 |
+
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pypcd"
|
| 106 |
+
@echo "# devhelp"
|
| 107 |
+
|
| 108 |
+
epub:
|
| 109 |
+
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
| 110 |
+
@echo
|
| 111 |
+
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
| 112 |
+
|
| 113 |
+
latex:
|
| 114 |
+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
| 115 |
+
@echo
|
| 116 |
+
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
| 117 |
+
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
| 118 |
+
"(use \`make latexpdf' here to do that automatically)."
|
| 119 |
+
|
| 120 |
+
latexpdf:
|
| 121 |
+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
| 122 |
+
@echo "Running LaTeX files through pdflatex..."
|
| 123 |
+
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
| 124 |
+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
| 125 |
+
|
| 126 |
+
latexpdfja:
|
| 127 |
+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
| 128 |
+
@echo "Running LaTeX files through platex and dvipdfmx..."
|
| 129 |
+
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
|
| 130 |
+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
| 131 |
+
|
| 132 |
+
text:
|
| 133 |
+
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
| 134 |
+
@echo
|
| 135 |
+
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
| 136 |
+
|
| 137 |
+
man:
|
| 138 |
+
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
| 139 |
+
@echo
|
| 140 |
+
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
| 141 |
+
|
| 142 |
+
texinfo:
|
| 143 |
+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
| 144 |
+
@echo
|
| 145 |
+
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
| 146 |
+
@echo "Run \`make' in that directory to run these through makeinfo" \
|
| 147 |
+
"(use \`make info' here to do that automatically)."
|
| 148 |
+
|
| 149 |
+
info:
|
| 150 |
+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
| 151 |
+
@echo "Running Texinfo files through makeinfo..."
|
| 152 |
+
make -C $(BUILDDIR)/texinfo info
|
| 153 |
+
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
| 154 |
+
|
| 155 |
+
gettext:
|
| 156 |
+
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
| 157 |
+
@echo
|
| 158 |
+
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
| 159 |
+
|
| 160 |
+
changes:
|
| 161 |
+
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
| 162 |
+
@echo
|
| 163 |
+
@echo "The overview file is in $(BUILDDIR)/changes."
|
| 164 |
+
|
| 165 |
+
linkcheck:
|
| 166 |
+
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
| 167 |
+
@echo
|
| 168 |
+
@echo "Link check complete; look for any errors in the above output " \
|
| 169 |
+
"or in $(BUILDDIR)/linkcheck/output.txt."
|
| 170 |
+
|
| 171 |
+
doctest:
|
| 172 |
+
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
| 173 |
+
@echo "Testing of doctests in the sources finished, look at the " \
|
| 174 |
+
"results in $(BUILDDIR)/doctest/output.txt."
|
| 175 |
+
|
| 176 |
+
xml:
|
| 177 |
+
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
|
| 178 |
+
@echo
|
| 179 |
+
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
|
| 180 |
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
|
| 6 |
+
#
|
| 7 |
+
# This file is execfile()d with the current directory set to its
|
| 8 |
+
# containing dir.
|
| 9 |
+
#
|
| 10 |
+
# Note that not all possible configuration values are present in this
|
| 11 |
+
# autogenerated file.
|
| 12 |
+
#
|
| 13 |
+
# All configuration values have a default; values that are commented out
|
| 14 |
+
# serve to show the default.
|
| 15 |
+
|
| 16 |
+
import sys
|
| 17 |
+
import os
|
| 18 |
+
|
| 19 |
+
# If extensions (or modules to document with autodoc) are in another directory,
|
| 20 |
+
# add these directories to sys.path here. If the directory is relative to the
|
| 21 |
+
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
| 22 |
+
sys.path.insert(0, os.path.abspath('../pypcd'))
|
| 23 |
+
|
| 24 |
+
# -- General configuration ------------------------------------------------
|
| 25 |
+
|
| 26 |
+
# If your documentation needs a minimal Sphinx version, state it here.
|
| 27 |
+
needs_sphinx = '1.0' # numpydoc requires sphinc >= 1.0
|
| 28 |
+
|
| 29 |
+
# Add any Sphinx extension module names here, as strings. They can be
|
| 30 |
+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
| 31 |
+
# ones.
|
| 32 |
+
sys.path.append(os.path.abspath('sphinxext'))
|
| 33 |
+
|
| 34 |
+
extensions = ['sphinx.ext.autodoc',
|
| 35 |
+
'sphinx.ext.doctest',
|
| 36 |
+
'sphinx.ext.intersphinx',
|
| 37 |
+
'sphinx.ext.todo',
|
| 38 |
+
'sphinx.ext.coverage',
|
| 39 |
+
'sphinx.ext.pngmath',
|
| 40 |
+
'sphinx.ext.ifconfig',
|
| 41 |
+
'sphinx.ext.autosummary',
|
| 42 |
+
'sphinx.ext.mathjax',
|
| 43 |
+
'math_dollar', # has to go before numpydoc
|
| 44 |
+
'numpydoc',
|
| 45 |
+
'github']
|
| 46 |
+
|
| 47 |
+
# Add any paths that contain templates here, relative to this directory.
|
| 48 |
+
templates_path = ['_templates']
|
| 49 |
+
|
| 50 |
+
# The suffix of source filenames.
|
| 51 |
+
source_suffix = '.rst'
|
| 52 |
+
|
| 53 |
+
# The encoding of source files.
|
| 54 |
+
#source_encoding = 'utf-8-sig'
|
| 55 |
+
|
| 56 |
+
# The master toctree document.
|
| 57 |
+
master_doc = 'index'
|
| 58 |
+
|
| 59 |
+
# General information about the project.
|
| 60 |
+
project = 'pypcd'
|
| 61 |
+
copyright = '2015, Daniel Maturana'
|
| 62 |
+
|
| 63 |
+
# The version info for the project you're documenting, acts as replacement for
|
| 64 |
+
# |version| and |release|, also used in various other places throughout the
|
| 65 |
+
# built documents.
|
| 66 |
+
#
|
| 67 |
+
# The short X.Y version.
|
| 68 |
+
version = ''''
|
| 69 |
+
# The full version, including alpha/beta/rc tags.
|
| 70 |
+
release = ''''
|
| 71 |
+
|
| 72 |
+
# The language for content autogenerated by Sphinx. Refer to documentation
|
| 73 |
+
# for a list of supported languages.
|
| 74 |
+
#language = None
|
| 75 |
+
|
| 76 |
+
# There are two options for replacing |today|: either, you set today to some
|
| 77 |
+
# non-false value, then it is used:
|
| 78 |
+
#today = ''
|
| 79 |
+
# Else, today_fmt is used as the format for a strftime call.
|
| 80 |
+
#today_fmt = '%B %d, %Y'
|
| 81 |
+
|
| 82 |
+
# List of patterns, relative to source directory, that match files and
|
| 83 |
+
# directories to ignore when looking for source files.
|
| 84 |
+
exclude_patterns = ['_build']
|
| 85 |
+
|
| 86 |
+
# The reST default role (used for this markup: `text`) to use for all
|
| 87 |
+
# documents.
|
| 88 |
+
#default_role = None
|
| 89 |
+
|
| 90 |
+
# If true, '()' will be appended to :func: etc. cross-reference text.
|
| 91 |
+
#add_function_parentheses = True
|
| 92 |
+
|
| 93 |
+
# If true, the current module name will be prepended to all description
|
| 94 |
+
# unit titles (such as .. function::).
|
| 95 |
+
#add_module_names = True
|
| 96 |
+
|
| 97 |
+
# If true, sectionauthor and moduleauthor directives will be shown in the
|
| 98 |
+
# output. They are ignored by default.
|
| 99 |
+
#show_authors = False
|
| 100 |
+
|
| 101 |
+
# The name of the Pygments (syntax highlighting) style to use.
|
| 102 |
+
pygments_style = 'sphinx'
|
| 103 |
+
|
| 104 |
+
# A list of ignored prefixes for module index sorting.
|
| 105 |
+
#modindex_common_prefix = []
|
| 106 |
+
|
| 107 |
+
# If true, keep warnings as "system message" paragraphs in the built documents.
|
| 108 |
+
#keep_warnings = False
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
# -- Options for HTML output ----------------------------------------------
|
| 112 |
+
|
| 113 |
+
# The theme to use for HTML and HTML Help pages. See the documentation for
|
| 114 |
+
# a list of builtin themes.
|
| 115 |
+
html_theme = 'sphinxdoc'
|
| 116 |
+
|
| 117 |
+
# Theme options are theme-specific and customize the look and feel of a theme
|
| 118 |
+
# further. For a list of options available for each theme, see the
|
| 119 |
+
# documentation.
|
| 120 |
+
#html_theme_options = {}
|
| 121 |
+
|
| 122 |
+
# Add any paths that contain custom themes here, relative to this directory.
|
| 123 |
+
#html_theme_path = []
|
| 124 |
+
|
| 125 |
+
# The name for this set of Sphinx documents. If None, it defaults to
|
| 126 |
+
# "<project> v<release> documentation".
|
| 127 |
+
#html_title = None
|
| 128 |
+
|
| 129 |
+
# A shorter title for the navigation bar. Default is the same as html_title.
|
| 130 |
+
#html_short_title = None
|
| 131 |
+
|
| 132 |
+
# The name of an image file (relative to this directory) to place at the top
|
| 133 |
+
# of the sidebar.
|
| 134 |
+
#html_logo = None
|
| 135 |
+
|
| 136 |
+
# The name of an image file (within the static path) to use as favicon of the
|
| 137 |
+
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
| 138 |
+
# pixels large.
|
| 139 |
+
#html_favicon = None
|
| 140 |
+
|
| 141 |
+
# Add any paths that contain custom static files (such as style sheets) here,
|
| 142 |
+
# relative to this directory. They are copied after the builtin static files,
|
| 143 |
+
# so a file named "default.css" will overwrite the builtin "default.css".
|
| 144 |
+
html_static_path = ['_static']
|
| 145 |
+
|
| 146 |
+
# Add any extra paths that contain custom files (such as robots.txt or
|
| 147 |
+
# .htaccess) here, relative to this directory. These files are copied
|
| 148 |
+
# directly to the root of the documentation.
|
| 149 |
+
#html_extra_path = []
|
| 150 |
+
|
| 151 |
+
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
| 152 |
+
# using the given strftime format.
|
| 153 |
+
#html_last_updated_fmt = '%b %d, %Y'
|
| 154 |
+
|
| 155 |
+
# If true, SmartyPants will be used to convert quotes and dashes to
|
| 156 |
+
# typographically correct entities.
|
| 157 |
+
#html_use_smartypants = True
|
| 158 |
+
|
| 159 |
+
# Custom sidebar templates, maps document names to template names.
|
| 160 |
+
#html_sidebars = {}
|
| 161 |
+
|
| 162 |
+
# Additional templates that should be rendered to pages, maps page names to
|
| 163 |
+
# template names.
|
| 164 |
+
#html_additional_pages = {}
|
| 165 |
+
|
| 166 |
+
# If false, no module index is generated.
|
| 167 |
+
#html_domain_indices = True
|
| 168 |
+
html_domain_indices = False
|
| 169 |
+
|
| 170 |
+
# If false, no index is generated.
|
| 171 |
+
#html_use_index = True
|
| 172 |
+
|
| 173 |
+
# If true, the index is split into individual pages for each letter.
|
| 174 |
+
#html_split_index = False
|
| 175 |
+
|
| 176 |
+
# If true, links to the reST sources are added to the pages.
|
| 177 |
+
#html_show_sourcelink = True
|
| 178 |
+
|
| 179 |
+
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
| 180 |
+
#html_show_sphinx = True
|
| 181 |
+
|
| 182 |
+
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
| 183 |
+
#html_show_copyright = True
|
| 184 |
+
|
| 185 |
+
# If true, an OpenSearch description file will be output, and all pages will
|
| 186 |
+
# contain a <link> tag referring to it. The value of this option must be the
|
| 187 |
+
# base URL from which the finished HTML is served.
|
| 188 |
+
#html_use_opensearch = ''
|
| 189 |
+
|
| 190 |
+
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
| 191 |
+
#html_file_suffix = None
|
| 192 |
+
|
| 193 |
+
# Output file base name for HTML help builder.
|
| 194 |
+
htmlhelp_basename = 'pypcddoc'
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
# -- Options for LaTeX output ---------------------------------------------
|
| 198 |
+
|
| 199 |
+
latex_elements = {
|
| 200 |
+
# The paper size ('letterpaper' or 'a4paper').
|
| 201 |
+
#'papersize': 'letterpaper',
|
| 202 |
+
|
| 203 |
+
# The font size ('10pt', '11pt' or '12pt').
|
| 204 |
+
#'pointsize': '10pt',
|
| 205 |
+
|
| 206 |
+
# Additional stuff for the LaTeX preamble.
|
| 207 |
+
#'preamble': '',
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
# Grouping the document tree into LaTeX files. List of tuples
|
| 211 |
+
# (source start file, target name, title,
|
| 212 |
+
# author, documentclass [howto, manual, or own class]).
|
| 213 |
+
latex_documents = [
|
| 214 |
+
('index',
|
| 215 |
+
'pypcd.tex',
|
| 216 |
+
'pypcd Documentation',
|
| 217 |
+
'Daniel Maturana',
|
| 218 |
+
'manual'),
|
| 219 |
+
]
|
| 220 |
+
|
| 221 |
+
# The name of an image file (relative to this directory) to place at the top of
|
| 222 |
+
# the title page.
|
| 223 |
+
#latex_logo = None
|
| 224 |
+
|
| 225 |
+
# For "manual" documents, if this is true, then toplevel headings are parts,
|
| 226 |
+
# not chapters.
|
| 227 |
+
#latex_use_parts = False
|
| 228 |
+
|
| 229 |
+
# If true, show page references after internal links.
|
| 230 |
+
#latex_show_pagerefs = False
|
| 231 |
+
|
| 232 |
+
# If true, show URL addresses after external links.
|
| 233 |
+
#latex_show_urls = False
|
| 234 |
+
|
| 235 |
+
# Documents to append as an appendix to all manuals.
|
| 236 |
+
#latex_appendices = []
|
| 237 |
+
|
| 238 |
+
# If false, no module index is generated.
|
| 239 |
+
#latex_domain_indices = True
|
| 240 |
+
|
| 241 |
+
|
| 242 |
+
# -- Options for manual page output ---------------------------------------
|
| 243 |
+
|
| 244 |
+
# One entry per manual page. List of tuples
|
| 245 |
+
# (source start file, name, description, authors, manual section).
|
| 246 |
+
man_pages = [
|
| 247 |
+
('index',
|
| 248 |
+
'pypcd', 'pypcd Documentation',
|
| 249 |
+
['Daniel Maturana'], 1)
|
| 250 |
+
]
|
| 251 |
+
|
| 252 |
+
# If true, show URL addresses after external links.
|
| 253 |
+
#man_show_urls = False
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
# -- Options for Texinfo output -------------------------------------------
|
| 257 |
+
|
| 258 |
+
# Grouping the document tree into Texinfo files. List of tuples
|
| 259 |
+
# (source start file, target name, title, author,
|
| 260 |
+
# dir menu entry, description, category)
|
| 261 |
+
texinfo_documents = [
|
| 262 |
+
('index',
|
| 263 |
+
'pypcd',
|
| 264 |
+
'pypcd Documentation',
|
| 265 |
+
'Daniel Maturana',
|
| 266 |
+
'pypcd',
|
| 267 |
+
'One line description of project.',
|
| 268 |
+
'Miscellaneous'),
|
| 269 |
+
]
|
| 270 |
+
|
| 271 |
+
# Documents to append as an appendix to all manuals.
|
| 272 |
+
#texinfo_appendices = []
|
| 273 |
+
|
| 274 |
+
# If false, no module index is generated.
|
| 275 |
+
texinfo_domain_indices = False
|
| 276 |
+
|
| 277 |
+
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
| 278 |
+
#texinfo_show_urls = 'footnote'
|
| 279 |
+
|
| 280 |
+
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
| 281 |
+
#texinfo_no_detailmenu = False
|
| 282 |
+
|
| 283 |
+
# Example configuration for intersphinx: refer to the Python standard library.
|
| 284 |
+
intersphinx_mapping = {'http://docs.python.org/': None}
|
Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/index.rst
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.. pypcd documentation master file, created by sphinx-quickstart on Tue Apr 14 10:29:06 2015. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive.
|
| 2 |
+
|
| 3 |
+
Welcome to pypcd's documentation!
|
| 4 |
+
====================================
|
| 5 |
+
|
| 6 |
+
`pypcd` is a template for a small scientific Python project.
|
| 7 |
+
|
| 8 |
+
This is a placeholder for now :/
|
| 9 |
+
|
| 10 |
+
Contents:
|
| 11 |
+
|
| 12 |
+
.. toctree::
|
| 13 |
+
:maxdepth: 2
|
| 14 |
+
|
| 15 |
+
reference/index
|
| 16 |
+
|
| 17 |
+
Indices and tables
|
| 18 |
+
==================
|
| 19 |
+
|
| 20 |
+
* :ref:`genindex`
|
| 21 |
+
* :ref:`modindex`
|
| 22 |
+
* :ref:`search`
|
Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/sphinxext/docscrape.py
ADDED
|
@@ -0,0 +1,570 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Extract reference documentation from the NumPy source tree.
|
| 2 |
+
|
| 3 |
+
"""
|
| 4 |
+
from __future__ import division, absolute_import, print_function
|
| 5 |
+
|
| 6 |
+
import inspect
|
| 7 |
+
import textwrap
|
| 8 |
+
import re
|
| 9 |
+
import pydoc
|
| 10 |
+
from warnings import warn
|
| 11 |
+
import collections
|
| 12 |
+
import sys
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
class Reader(object):
|
| 16 |
+
"""A line-based string reader.
|
| 17 |
+
|
| 18 |
+
"""
|
| 19 |
+
def __init__(self, data):
|
| 20 |
+
"""
|
| 21 |
+
Parameters
|
| 22 |
+
----------
|
| 23 |
+
data : str
|
| 24 |
+
String with lines separated by '\n'.
|
| 25 |
+
|
| 26 |
+
"""
|
| 27 |
+
if isinstance(data, list):
|
| 28 |
+
self._str = data
|
| 29 |
+
else:
|
| 30 |
+
self._str = data.split('\n') # store string as list of lines
|
| 31 |
+
|
| 32 |
+
self.reset()
|
| 33 |
+
|
| 34 |
+
def __getitem__(self, n):
|
| 35 |
+
return self._str[n]
|
| 36 |
+
|
| 37 |
+
def reset(self):
|
| 38 |
+
self._l = 0 # current line nr
|
| 39 |
+
|
| 40 |
+
def read(self):
|
| 41 |
+
if not self.eof():
|
| 42 |
+
out = self[self._l]
|
| 43 |
+
self._l += 1
|
| 44 |
+
return out
|
| 45 |
+
else:
|
| 46 |
+
return ''
|
| 47 |
+
|
| 48 |
+
def seek_next_non_empty_line(self):
|
| 49 |
+
for l in self[self._l:]:
|
| 50 |
+
if l.strip():
|
| 51 |
+
break
|
| 52 |
+
else:
|
| 53 |
+
self._l += 1
|
| 54 |
+
|
| 55 |
+
def eof(self):
|
| 56 |
+
return self._l >= len(self._str)
|
| 57 |
+
|
| 58 |
+
def read_to_condition(self, condition_func):
|
| 59 |
+
start = self._l
|
| 60 |
+
for line in self[start:]:
|
| 61 |
+
if condition_func(line):
|
| 62 |
+
return self[start:self._l]
|
| 63 |
+
self._l += 1
|
| 64 |
+
if self.eof():
|
| 65 |
+
return self[start:self._l+1]
|
| 66 |
+
return []
|
| 67 |
+
|
| 68 |
+
def read_to_next_empty_line(self):
|
| 69 |
+
self.seek_next_non_empty_line()
|
| 70 |
+
|
| 71 |
+
def is_empty(line):
|
| 72 |
+
return not line.strip()
|
| 73 |
+
|
| 74 |
+
return self.read_to_condition(is_empty)
|
| 75 |
+
|
| 76 |
+
def read_to_next_unindented_line(self):
|
| 77 |
+
def is_unindented(line):
|
| 78 |
+
return (line.strip() and (len(line.lstrip()) == len(line)))
|
| 79 |
+
return self.read_to_condition(is_unindented)
|
| 80 |
+
|
| 81 |
+
def peek(self, n=0):
|
| 82 |
+
if self._l + n < len(self._str):
|
| 83 |
+
return self[self._l + n]
|
| 84 |
+
else:
|
| 85 |
+
return ''
|
| 86 |
+
|
| 87 |
+
def is_empty(self):
|
| 88 |
+
return not ''.join(self._str).strip()
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
class NumpyDocString(collections.Mapping):
|
| 92 |
+
def __init__(self, docstring, config={}):
|
| 93 |
+
docstring = textwrap.dedent(docstring).split('\n')
|
| 94 |
+
|
| 95 |
+
self._doc = Reader(docstring)
|
| 96 |
+
self._parsed_data = {
|
| 97 |
+
'Signature': '',
|
| 98 |
+
'Summary': [''],
|
| 99 |
+
'Extended Summary': [],
|
| 100 |
+
'Parameters': [],
|
| 101 |
+
'Returns': [],
|
| 102 |
+
'Yields': [],
|
| 103 |
+
'Raises': [],
|
| 104 |
+
'Warns': [],
|
| 105 |
+
'Other Parameters': [],
|
| 106 |
+
'Attributes': [],
|
| 107 |
+
'Methods': [],
|
| 108 |
+
'See Also': [],
|
| 109 |
+
'Notes': [],
|
| 110 |
+
'Warnings': [],
|
| 111 |
+
'References': '',
|
| 112 |
+
'Examples': '',
|
| 113 |
+
'index': {}
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
self._parse()
|
| 117 |
+
|
| 118 |
+
def __getitem__(self, key):
|
| 119 |
+
return self._parsed_data[key]
|
| 120 |
+
|
| 121 |
+
def __setitem__(self, key, val):
|
| 122 |
+
if key not in self._parsed_data:
|
| 123 |
+
warn("Unknown section %s" % key)
|
| 124 |
+
else:
|
| 125 |
+
self._parsed_data[key] = val
|
| 126 |
+
|
| 127 |
+
def __iter__(self):
|
| 128 |
+
return iter(self._parsed_data)
|
| 129 |
+
|
| 130 |
+
def __len__(self):
|
| 131 |
+
return len(self._parsed_data)
|
| 132 |
+
|
| 133 |
+
def _is_at_section(self):
|
| 134 |
+
self._doc.seek_next_non_empty_line()
|
| 135 |
+
|
| 136 |
+
if self._doc.eof():
|
| 137 |
+
return False
|
| 138 |
+
|
| 139 |
+
l1 = self._doc.peek().strip() # e.g. Parameters
|
| 140 |
+
|
| 141 |
+
if l1.startswith('.. index::'):
|
| 142 |
+
return True
|
| 143 |
+
|
| 144 |
+
l2 = self._doc.peek(1).strip() # ---------- or ==========
|
| 145 |
+
return l2.startswith('-'*len(l1)) or l2.startswith('='*len(l1))
|
| 146 |
+
|
| 147 |
+
def _strip(self, doc):
|
| 148 |
+
i = 0
|
| 149 |
+
j = 0
|
| 150 |
+
for i, line in enumerate(doc):
|
| 151 |
+
if line.strip():
|
| 152 |
+
break
|
| 153 |
+
|
| 154 |
+
for j, line in enumerate(doc[::-1]):
|
| 155 |
+
if line.strip():
|
| 156 |
+
break
|
| 157 |
+
|
| 158 |
+
return doc[i:len(doc)-j]
|
| 159 |
+
|
| 160 |
+
def _read_to_next_section(self):
|
| 161 |
+
section = self._doc.read_to_next_empty_line()
|
| 162 |
+
|
| 163 |
+
while not self._is_at_section() and not self._doc.eof():
|
| 164 |
+
if not self._doc.peek(-1).strip(): # previous line was empty
|
| 165 |
+
section += ['']
|
| 166 |
+
|
| 167 |
+
section += self._doc.read_to_next_empty_line()
|
| 168 |
+
|
| 169 |
+
return section
|
| 170 |
+
|
| 171 |
+
def _read_sections(self):
|
| 172 |
+
while not self._doc.eof():
|
| 173 |
+
data = self._read_to_next_section()
|
| 174 |
+
name = data[0].strip()
|
| 175 |
+
|
| 176 |
+
if name.startswith('..'): # index section
|
| 177 |
+
yield name, data[1:]
|
| 178 |
+
elif len(data) < 2:
|
| 179 |
+
yield StopIteration
|
| 180 |
+
else:
|
| 181 |
+
yield name, self._strip(data[2:])
|
| 182 |
+
|
| 183 |
+
def _parse_param_list(self, content):
|
| 184 |
+
r = Reader(content)
|
| 185 |
+
params = []
|
| 186 |
+
while not r.eof():
|
| 187 |
+
header = r.read().strip()
|
| 188 |
+
if ' : ' in header:
|
| 189 |
+
arg_name, arg_type = header.split(' : ')[:2]
|
| 190 |
+
else:
|
| 191 |
+
arg_name, arg_type = header, ''
|
| 192 |
+
|
| 193 |
+
desc = r.read_to_next_unindented_line()
|
| 194 |
+
desc = dedent_lines(desc)
|
| 195 |
+
|
| 196 |
+
params.append((arg_name, arg_type, desc))
|
| 197 |
+
|
| 198 |
+
return params
|
| 199 |
+
|
| 200 |
+
_name_rgx = re.compile(r"^\s*(:(?P<role>\w+):`(?P<name>[a-zA-Z0-9_.-]+)`|"
|
| 201 |
+
r" (?P<name2>[a-zA-Z0-9_.-]+))\s*", re.X)
|
| 202 |
+
|
| 203 |
+
def _parse_see_also(self, content):
|
| 204 |
+
"""
|
| 205 |
+
func_name : Descriptive text
|
| 206 |
+
continued text
|
| 207 |
+
another_func_name : Descriptive text
|
| 208 |
+
func_name1, func_name2, :meth:`func_name`, func_name3
|
| 209 |
+
|
| 210 |
+
"""
|
| 211 |
+
items = []
|
| 212 |
+
|
| 213 |
+
def parse_item_name(text):
|
| 214 |
+
"""Match ':role:`name`' or 'name'"""
|
| 215 |
+
m = self._name_rgx.match(text)
|
| 216 |
+
if m:
|
| 217 |
+
g = m.groups()
|
| 218 |
+
if g[1] is None:
|
| 219 |
+
return g[3], None
|
| 220 |
+
else:
|
| 221 |
+
return g[2], g[1]
|
| 222 |
+
raise ValueError("%s is not a item name" % text)
|
| 223 |
+
|
| 224 |
+
def push_item(name, rest):
|
| 225 |
+
if not name:
|
| 226 |
+
return
|
| 227 |
+
name, role = parse_item_name(name)
|
| 228 |
+
items.append((name, list(rest), role))
|
| 229 |
+
del rest[:]
|
| 230 |
+
|
| 231 |
+
current_func = None
|
| 232 |
+
rest = []
|
| 233 |
+
|
| 234 |
+
for line in content:
|
| 235 |
+
if not line.strip():
|
| 236 |
+
continue
|
| 237 |
+
|
| 238 |
+
m = self._name_rgx.match(line)
|
| 239 |
+
if m and line[m.end():].strip().startswith(':'):
|
| 240 |
+
push_item(current_func, rest)
|
| 241 |
+
current_func, line = line[:m.end()], line[m.end():]
|
| 242 |
+
rest = [line.split(':', 1)[1].strip()]
|
| 243 |
+
if not rest[0]:
|
| 244 |
+
rest = []
|
| 245 |
+
elif not line.startswith(' '):
|
| 246 |
+
push_item(current_func, rest)
|
| 247 |
+
current_func = None
|
| 248 |
+
if ',' in line:
|
| 249 |
+
for func in line.split(','):
|
| 250 |
+
if func.strip():
|
| 251 |
+
push_item(func, [])
|
| 252 |
+
elif line.strip():
|
| 253 |
+
current_func = line
|
| 254 |
+
elif current_func is not None:
|
| 255 |
+
rest.append(line.strip())
|
| 256 |
+
push_item(current_func, rest)
|
| 257 |
+
return items
|
| 258 |
+
|
| 259 |
+
def _parse_index(self, section, content):
|
| 260 |
+
"""
|
| 261 |
+
.. index: default
|
| 262 |
+
:refguide: something, else, and more
|
| 263 |
+
|
| 264 |
+
"""
|
| 265 |
+
def strip_each_in(lst):
|
| 266 |
+
return [s.strip() for s in lst]
|
| 267 |
+
|
| 268 |
+
out = {}
|
| 269 |
+
section = section.split('::')
|
| 270 |
+
if len(section) > 1:
|
| 271 |
+
out['default'] = strip_each_in(section[1].split(','))[0]
|
| 272 |
+
for line in content:
|
| 273 |
+
line = line.split(':')
|
| 274 |
+
if len(line) > 2:
|
| 275 |
+
out[line[1]] = strip_each_in(line[2].split(','))
|
| 276 |
+
return out
|
| 277 |
+
|
| 278 |
+
def _parse_summary(self):
|
| 279 |
+
"""Grab signature (if given) and summary"""
|
| 280 |
+
if self._is_at_section():
|
| 281 |
+
return
|
| 282 |
+
|
| 283 |
+
# If several signatures present, take the last one
|
| 284 |
+
while True:
|
| 285 |
+
summary = self._doc.read_to_next_empty_line()
|
| 286 |
+
summary_str = " ".join([s.strip() for s in summary]).strip()
|
| 287 |
+
if re.compile('^([\w., ]+=)?\s*[\w\.]+\(.*\)$').match(summary_str):
|
| 288 |
+
self['Signature'] = summary_str
|
| 289 |
+
if not self._is_at_section():
|
| 290 |
+
continue
|
| 291 |
+
break
|
| 292 |
+
|
| 293 |
+
if summary is not None:
|
| 294 |
+
self['Summary'] = summary
|
| 295 |
+
|
| 296 |
+
if not self._is_at_section():
|
| 297 |
+
self['Extended Summary'] = self._read_to_next_section()
|
| 298 |
+
|
| 299 |
+
def _parse(self):
|
| 300 |
+
self._doc.reset()
|
| 301 |
+
self._parse_summary()
|
| 302 |
+
|
| 303 |
+
sections = list(self._read_sections())
|
| 304 |
+
section_names = set([section for section, content in sections])
|
| 305 |
+
|
| 306 |
+
has_returns = 'Returns' in section_names
|
| 307 |
+
has_yields = 'Yields' in section_names
|
| 308 |
+
# We could do more tests, but we are not. Arbitrarily.
|
| 309 |
+
if has_returns and has_yields:
|
| 310 |
+
msg = 'Docstring contains both a Returns and Yields section.'
|
| 311 |
+
raise ValueError(msg)
|
| 312 |
+
|
| 313 |
+
for (section, content) in sections:
|
| 314 |
+
if not section.startswith('..'):
|
| 315 |
+
section = (s.capitalize() for s in section.split(' '))
|
| 316 |
+
section = ' '.join(section)
|
| 317 |
+
if section in ('Parameters', 'Returns', 'Yields', 'Raises',
|
| 318 |
+
'Warns', 'Other Parameters', 'Attributes',
|
| 319 |
+
'Methods'):
|
| 320 |
+
self[section] = self._parse_param_list(content)
|
| 321 |
+
elif section.startswith('.. index::'):
|
| 322 |
+
self['index'] = self._parse_index(section, content)
|
| 323 |
+
elif section == 'See Also':
|
| 324 |
+
self['See Also'] = self._parse_see_also(content)
|
| 325 |
+
else:
|
| 326 |
+
self[section] = content
|
| 327 |
+
|
| 328 |
+
# string conversion routines
|
| 329 |
+
|
| 330 |
+
def _str_header(self, name, symbol='-'):
|
| 331 |
+
return [name, len(name)*symbol]
|
| 332 |
+
|
| 333 |
+
def _str_indent(self, doc, indent=4):
|
| 334 |
+
out = []
|
| 335 |
+
for line in doc:
|
| 336 |
+
out += [' '*indent + line]
|
| 337 |
+
return out
|
| 338 |
+
|
| 339 |
+
def _str_signature(self):
|
| 340 |
+
if self['Signature']:
|
| 341 |
+
return [self['Signature'].replace('*', '\*')] + ['']
|
| 342 |
+
else:
|
| 343 |
+
return ['']
|
| 344 |
+
|
| 345 |
+
def _str_summary(self):
|
| 346 |
+
if self['Summary']:
|
| 347 |
+
return self['Summary'] + ['']
|
| 348 |
+
else:
|
| 349 |
+
return []
|
| 350 |
+
|
| 351 |
+
def _str_extended_summary(self):
|
| 352 |
+
if self['Extended Summary']:
|
| 353 |
+
return self['Extended Summary'] + ['']
|
| 354 |
+
else:
|
| 355 |
+
return []
|
| 356 |
+
|
| 357 |
+
def _str_param_list(self, name):
|
| 358 |
+
out = []
|
| 359 |
+
if self[name]:
|
| 360 |
+
out += self._str_header(name)
|
| 361 |
+
for param, param_type, desc in self[name]:
|
| 362 |
+
if param_type:
|
| 363 |
+
out += ['%s : %s' % (param, param_type)]
|
| 364 |
+
else:
|
| 365 |
+
out += [param]
|
| 366 |
+
out += self._str_indent(desc)
|
| 367 |
+
out += ['']
|
| 368 |
+
return out
|
| 369 |
+
|
| 370 |
+
def _str_section(self, name):
|
| 371 |
+
out = []
|
| 372 |
+
if self[name]:
|
| 373 |
+
out += self._str_header(name)
|
| 374 |
+
out += self[name]
|
| 375 |
+
out += ['']
|
| 376 |
+
return out
|
| 377 |
+
|
| 378 |
+
def _str_see_also(self, func_role):
|
| 379 |
+
if not self['See Also']:
|
| 380 |
+
return []
|
| 381 |
+
out = []
|
| 382 |
+
out += self._str_header("See Also")
|
| 383 |
+
last_had_desc = True
|
| 384 |
+
for func, desc, role in self['See Also']:
|
| 385 |
+
if role:
|
| 386 |
+
link = ':%s:`%s`' % (role, func)
|
| 387 |
+
elif func_role:
|
| 388 |
+
link = ':%s:`%s`' % (func_role, func)
|
| 389 |
+
else:
|
| 390 |
+
link = "`%s`_" % func
|
| 391 |
+
if desc or last_had_desc:
|
| 392 |
+
out += ['']
|
| 393 |
+
out += [link]
|
| 394 |
+
else:
|
| 395 |
+
out[-1] += ", %s" % link
|
| 396 |
+
if desc:
|
| 397 |
+
out += self._str_indent([' '.join(desc)])
|
| 398 |
+
last_had_desc = True
|
| 399 |
+
else:
|
| 400 |
+
last_had_desc = False
|
| 401 |
+
out += ['']
|
| 402 |
+
return out
|
| 403 |
+
|
| 404 |
+
def _str_index(self):
|
| 405 |
+
idx = self['index']
|
| 406 |
+
out = []
|
| 407 |
+
out += ['.. index:: %s' % idx.get('default', '')]
|
| 408 |
+
for section, references in idx.items():
|
| 409 |
+
if section == 'default':
|
| 410 |
+
continue
|
| 411 |
+
out += [' :%s: %s' % (section, ', '.join(references))]
|
| 412 |
+
return out
|
| 413 |
+
|
| 414 |
+
def __str__(self, func_role=''):
|
| 415 |
+
out = []
|
| 416 |
+
out += self._str_signature()
|
| 417 |
+
out += self._str_summary()
|
| 418 |
+
out += self._str_extended_summary()
|
| 419 |
+
for param_list in ('Parameters', 'Returns', 'Yields',
|
| 420 |
+
'Other Parameters', 'Raises', 'Warns'):
|
| 421 |
+
out += self._str_param_list(param_list)
|
| 422 |
+
out += self._str_section('Warnings')
|
| 423 |
+
out += self._str_see_also(func_role)
|
| 424 |
+
for s in ('Notes', 'References', 'Examples'):
|
| 425 |
+
out += self._str_section(s)
|
| 426 |
+
for param_list in ('Attributes', 'Methods'):
|
| 427 |
+
out += self._str_param_list(param_list)
|
| 428 |
+
out += self._str_index()
|
| 429 |
+
return '\n'.join(out)
|
| 430 |
+
|
| 431 |
+
|
| 432 |
+
def indent(str, indent=4):
|
| 433 |
+
indent_str = ' '*indent
|
| 434 |
+
if str is None:
|
| 435 |
+
return indent_str
|
| 436 |
+
lines = str.split('\n')
|
| 437 |
+
return '\n'.join(indent_str + l for l in lines)
|
| 438 |
+
|
| 439 |
+
|
| 440 |
+
def dedent_lines(lines):
|
| 441 |
+
"""Deindent a list of lines maximally"""
|
| 442 |
+
return textwrap.dedent("\n".join(lines)).split("\n")
|
| 443 |
+
|
| 444 |
+
|
| 445 |
+
def header(text, style='-'):
|
| 446 |
+
return text + '\n' + style*len(text) + '\n'
|
| 447 |
+
|
| 448 |
+
|
| 449 |
+
class FunctionDoc(NumpyDocString):
|
| 450 |
+
def __init__(self, func, role='func', doc=None, config={}):
|
| 451 |
+
self._f = func
|
| 452 |
+
self._role = role # e.g. "func" or "meth"
|
| 453 |
+
|
| 454 |
+
if doc is None:
|
| 455 |
+
if func is None:
|
| 456 |
+
raise ValueError("No function or docstring given")
|
| 457 |
+
doc = inspect.getdoc(func) or ''
|
| 458 |
+
NumpyDocString.__init__(self, doc)
|
| 459 |
+
|
| 460 |
+
if not self['Signature'] and func is not None:
|
| 461 |
+
func, func_name = self.get_func()
|
| 462 |
+
try:
|
| 463 |
+
# try to read signature
|
| 464 |
+
if sys.version_info[0] >= 3:
|
| 465 |
+
argspec = inspect.getfullargspec(func)
|
| 466 |
+
else:
|
| 467 |
+
argspec = inspect.getargspec(func)
|
| 468 |
+
argspec = inspect.formatargspec(*argspec)
|
| 469 |
+
argspec = argspec.replace('*', '\*')
|
| 470 |
+
signature = '%s%s' % (func_name, argspec)
|
| 471 |
+
except TypeError as e:
|
| 472 |
+
signature = '%s()' % func_name
|
| 473 |
+
self['Signature'] = signature
|
| 474 |
+
|
| 475 |
+
def get_func(self):
|
| 476 |
+
func_name = getattr(self._f, '__name__', self.__class__.__name__)
|
| 477 |
+
if inspect.isclass(self._f):
|
| 478 |
+
func = getattr(self._f, '__call__', self._f.__init__)
|
| 479 |
+
else:
|
| 480 |
+
func = self._f
|
| 481 |
+
return func, func_name
|
| 482 |
+
|
| 483 |
+
def __str__(self):
|
| 484 |
+
out = ''
|
| 485 |
+
|
| 486 |
+
func, func_name = self.get_func()
|
| 487 |
+
signature = self['Signature'].replace('*', '\*')
|
| 488 |
+
|
| 489 |
+
roles = {'func': 'function',
|
| 490 |
+
'meth': 'method'}
|
| 491 |
+
|
| 492 |
+
if self._role:
|
| 493 |
+
if self._role not in roles:
|
| 494 |
+
print("Warning: invalid role %s" % self._role)
|
| 495 |
+
out += '.. %s:: %s\n \n\n' % (roles.get(self._role, ''),
|
| 496 |
+
func_name)
|
| 497 |
+
|
| 498 |
+
out += super(FunctionDoc, self).__str__(func_role=self._role)
|
| 499 |
+
return out
|
| 500 |
+
|
| 501 |
+
|
| 502 |
+
class ClassDoc(NumpyDocString):
|
| 503 |
+
|
| 504 |
+
extra_public_methods = ['__call__']
|
| 505 |
+
|
| 506 |
+
def __init__(self, cls, doc=None, modulename='', func_doc=FunctionDoc,
|
| 507 |
+
config={}):
|
| 508 |
+
if not inspect.isclass(cls) and cls is not None:
|
| 509 |
+
raise ValueError("Expected a class or None, but got %r" % cls)
|
| 510 |
+
self._cls = cls
|
| 511 |
+
|
| 512 |
+
self.show_inherited_members = config.get(
|
| 513 |
+
'show_inherited_class_members', True)
|
| 514 |
+
|
| 515 |
+
if modulename and not modulename.endswith('.'):
|
| 516 |
+
modulename += '.'
|
| 517 |
+
self._mod = modulename
|
| 518 |
+
|
| 519 |
+
if doc is None:
|
| 520 |
+
if cls is None:
|
| 521 |
+
raise ValueError("No class or documentation string given")
|
| 522 |
+
doc = pydoc.getdoc(cls)
|
| 523 |
+
|
| 524 |
+
NumpyDocString.__init__(self, doc)
|
| 525 |
+
|
| 526 |
+
if config.get('show_class_members', True):
|
| 527 |
+
def splitlines_x(s):
|
| 528 |
+
if not s:
|
| 529 |
+
return []
|
| 530 |
+
else:
|
| 531 |
+
return s.splitlines()
|
| 532 |
+
|
| 533 |
+
for field, items in [('Methods', self.methods),
|
| 534 |
+
('Attributes', self.properties)]:
|
| 535 |
+
if not self[field]:
|
| 536 |
+
doc_list = []
|
| 537 |
+
for name in sorted(items):
|
| 538 |
+
try:
|
| 539 |
+
doc_item = pydoc.getdoc(getattr(self._cls, name))
|
| 540 |
+
doc_list.append((name, '', splitlines_x(doc_item)))
|
| 541 |
+
except AttributeError:
|
| 542 |
+
pass # method doesn't exist
|
| 543 |
+
self[field] = doc_list
|
| 544 |
+
|
| 545 |
+
@property
|
| 546 |
+
def methods(self):
|
| 547 |
+
if self._cls is None:
|
| 548 |
+
return []
|
| 549 |
+
return [name for name, func in inspect.getmembers(self._cls)
|
| 550 |
+
if ((not name.startswith('_')
|
| 551 |
+
or name in self.extra_public_methods)
|
| 552 |
+
and isinstance(func, collections.Callable)
|
| 553 |
+
and self._is_show_member(name))]
|
| 554 |
+
|
| 555 |
+
@property
|
| 556 |
+
def properties(self):
|
| 557 |
+
if self._cls is None:
|
| 558 |
+
return []
|
| 559 |
+
return [name for name, func in inspect.getmembers(self._cls)
|
| 560 |
+
if (not name.startswith('_') and
|
| 561 |
+
(func is None or isinstance(func, property) or
|
| 562 |
+
inspect.isgetsetdescriptor(func))
|
| 563 |
+
and self._is_show_member(name))]
|
| 564 |
+
|
| 565 |
+
def _is_show_member(self, name):
|
| 566 |
+
if self.show_inherited_members:
|
| 567 |
+
return True # show all class members
|
| 568 |
+
if name not in self._cls.__dict__:
|
| 569 |
+
return False # class member is inherited, we do not show it
|
| 570 |
+
return True
|
Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/sphinxext/docscrape_sphinx.py
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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+
def __init__(self, docstring, config={}):
|
| 7 |
+
self.use_plots = config.get('use_plots', False)
|
| 8 |
+
NumpyDocString.__init__(self, docstring, config=config)
|
| 9 |
+
|
| 10 |
+
# string conversion routines
|
| 11 |
+
def _str_header(self, name, symbol='`'):
|
| 12 |
+
return ['.. rubric:: ' + name, '']
|
| 13 |
+
|
| 14 |
+
def _str_field_list(self, name):
|
| 15 |
+
return [':' + name + ':']
|
| 16 |
+
|
| 17 |
+
def _str_indent(self, doc, indent=4):
|
| 18 |
+
out = []
|
| 19 |
+
for line in doc:
|
| 20 |
+
out += [' '*indent + line]
|
| 21 |
+
return out
|
| 22 |
+
|
| 23 |
+
def _str_signature(self):
|
| 24 |
+
return ['']
|
| 25 |
+
if self['Signature']:
|
| 26 |
+
return ['``%s``' % self['Signature']] + ['']
|
| 27 |
+
else:
|
| 28 |
+
return ['']
|
| 29 |
+
|
| 30 |
+
def _str_summary(self):
|
| 31 |
+
return self['Summary'] + ['']
|
| 32 |
+
|
| 33 |
+
def _str_extended_summary(self):
|
| 34 |
+
return self['Extended Summary'] + ['']
|
| 35 |
+
|
| 36 |
+
def _str_param_list(self, name):
|
| 37 |
+
out = []
|
| 38 |
+
if self[name]:
|
| 39 |
+
out += self._str_field_list(name)
|
| 40 |
+
out += ['']
|
| 41 |
+
for param,param_type,desc in self[name]:
|
| 42 |
+
out += self._str_indent(['**%s** : %s' % (param.strip(),
|
| 43 |
+
param_type)])
|
| 44 |
+
out += ['']
|
| 45 |
+
out += self._str_indent(desc,8)
|
| 46 |
+
out += ['']
|
| 47 |
+
return out
|
| 48 |
+
|
| 49 |
+
@property
|
| 50 |
+
def _obj(self):
|
| 51 |
+
if hasattr(self, '_cls'):
|
| 52 |
+
return self._cls
|
| 53 |
+
elif hasattr(self, '_f'):
|
| 54 |
+
return self._f
|
| 55 |
+
return None
|
| 56 |
+
|
| 57 |
+
def _str_member_list(self, name):
|
| 58 |
+
"""
|
| 59 |
+
Generate a member listing, autosummary:: table where possible,
|
| 60 |
+
and a table where not.
|
| 61 |
+
|
| 62 |
+
"""
|
| 63 |
+
out = []
|
| 64 |
+
if self[name]:
|
| 65 |
+
out += ['.. rubric:: %s' % name, '']
|
| 66 |
+
prefix = getattr(self, '_name', '')
|
| 67 |
+
|
| 68 |
+
if prefix:
|
| 69 |
+
prefix = '~%s.' % prefix
|
| 70 |
+
|
| 71 |
+
autosum = []
|
| 72 |
+
others = []
|
| 73 |
+
for param, param_type, desc in self[name]:
|
| 74 |
+
param = param.strip()
|
| 75 |
+
if not self._obj or hasattr(self._obj, param):
|
| 76 |
+
autosum += [" %s%s" % (prefix, param)]
|
| 77 |
+
else:
|
| 78 |
+
others.append((param, param_type, desc))
|
| 79 |
+
|
| 80 |
+
if autosum:
|
| 81 |
+
out += ['.. autosummary::', ' :toctree:', '']
|
| 82 |
+
out += autosum
|
| 83 |
+
|
| 84 |
+
if others:
|
| 85 |
+
maxlen_0 = max([len(x[0]) for x in others])
|
| 86 |
+
maxlen_1 = max([len(x[1]) for x in others])
|
| 87 |
+
hdr = "="*maxlen_0 + " " + "="*maxlen_1 + " " + "="*10
|
| 88 |
+
fmt = '%%%ds %%%ds ' % (maxlen_0, maxlen_1)
|
| 89 |
+
n_indent = maxlen_0 + maxlen_1 + 4
|
| 90 |
+
out += [hdr]
|
| 91 |
+
for param, param_type, desc in others:
|
| 92 |
+
out += [fmt % (param.strip(), param_type)]
|
| 93 |
+
out += self._str_indent(desc, n_indent)
|
| 94 |
+
out += [hdr]
|
| 95 |
+
out += ['']
|
| 96 |
+
return out
|
| 97 |
+
|
| 98 |
+
def _str_section(self, name):
|
| 99 |
+
out = []
|
| 100 |
+
if self[name]:
|
| 101 |
+
out += self._str_header(name)
|
| 102 |
+
out += ['']
|
| 103 |
+
content = textwrap.dedent("\n".join(self[name])).split("\n")
|
| 104 |
+
out += content
|
| 105 |
+
out += ['']
|
| 106 |
+
return out
|
| 107 |
+
|
| 108 |
+
def _str_see_also(self, func_role):
|
| 109 |
+
out = []
|
| 110 |
+
if self['See Also']:
|
| 111 |
+
see_also = super(SphinxDocString, self)._str_see_also(func_role)
|
| 112 |
+
out = ['.. seealso::', '']
|
| 113 |
+
out += self._str_indent(see_also[2:])
|
| 114 |
+
return out
|
| 115 |
+
|
| 116 |
+
def _str_warnings(self):
|
| 117 |
+
out = []
|
| 118 |
+
if self['Warnings']:
|
| 119 |
+
out = ['.. warning::', '']
|
| 120 |
+
out += self._str_indent(self['Warnings'])
|
| 121 |
+
return out
|
| 122 |
+
|
| 123 |
+
def _str_index(self):
|
| 124 |
+
idx = self['index']
|
| 125 |
+
out = []
|
| 126 |
+
if len(idx) == 0:
|
| 127 |
+
return out
|
| 128 |
+
|
| 129 |
+
out += ['.. index:: %s' % idx.get('default','')]
|
| 130 |
+
for section, references in idx.iteritems():
|
| 131 |
+
if section == 'default':
|
| 132 |
+
continue
|
| 133 |
+
elif section == 'refguide':
|
| 134 |
+
out += [' single: %s' % (', '.join(references))]
|
| 135 |
+
else:
|
| 136 |
+
out += [' %s: %s' % (section, ','.join(references))]
|
| 137 |
+
return out
|
| 138 |
+
|
| 139 |
+
def _str_references(self):
|
| 140 |
+
out = []
|
| 141 |
+
if self['References']:
|
| 142 |
+
out += self._str_header('References')
|
| 143 |
+
if isinstance(self['References'], str):
|
| 144 |
+
self['References'] = [self['References']]
|
| 145 |
+
out.extend(self['References'])
|
| 146 |
+
out += ['']
|
| 147 |
+
# Latex collects all references to a separate bibliography,
|
| 148 |
+
# so we need to insert links to it
|
| 149 |
+
if sphinx.__version__ >= "0.6":
|
| 150 |
+
out += ['.. only:: latex','']
|
| 151 |
+
else:
|
| 152 |
+
out += ['.. latexonly::','']
|
| 153 |
+
items = []
|
| 154 |
+
for line in self['References']:
|
| 155 |
+
m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I)
|
| 156 |
+
if m:
|
| 157 |
+
items.append(m.group(1))
|
| 158 |
+
out += [' ' + ", ".join(["[%s]_" % item for item in items]), '']
|
| 159 |
+
return out
|
| 160 |
+
|
| 161 |
+
def _str_examples(self):
|
| 162 |
+
examples_str = "\n".join(self['Examples'])
|
| 163 |
+
|
| 164 |
+
if (self.use_plots and 'import matplotlib' in examples_str
|
| 165 |
+
and 'plot::' not in examples_str):
|
| 166 |
+
out = []
|
| 167 |
+
out += self._str_header('Examples')
|
| 168 |
+
out += ['.. plot::', '']
|
| 169 |
+
out += self._str_indent(self['Examples'])
|
| 170 |
+
out += ['']
|
| 171 |
+
return out
|
| 172 |
+
else:
|
| 173 |
+
return self._str_section('Examples')
|
| 174 |
+
|
| 175 |
+
def __str__(self, indent=0, func_role="obj"):
|
| 176 |
+
out = []
|
| 177 |
+
out += self._str_signature()
|
| 178 |
+
out += self._str_index() + ['']
|
| 179 |
+
out += self._str_summary()
|
| 180 |
+
out += self._str_extended_summary()
|
| 181 |
+
for param_list in ('Parameters', 'Returns', 'Other Parameters',
|
| 182 |
+
'Raises', 'Warns'):
|
| 183 |
+
out += self._str_param_list(param_list)
|
| 184 |
+
out += self._str_warnings()
|
| 185 |
+
out += self._str_see_also(func_role)
|
| 186 |
+
out += self._str_section('Notes')
|
| 187 |
+
out += self._str_references()
|
| 188 |
+
out += self._str_examples()
|
| 189 |
+
for param_list in ('Attributes', 'Methods'):
|
| 190 |
+
out += self._str_member_list(param_list)
|
| 191 |
+
out = self._str_indent(out,indent)
|
| 192 |
+
return '\n'.join(out)
|
| 193 |
+
|
| 194 |
+
class SphinxFunctionDoc(SphinxDocString, FunctionDoc):
|
| 195 |
+
def __init__(self, obj, doc=None, config={}):
|
| 196 |
+
self.use_plots = config.get('use_plots', False)
|
| 197 |
+
FunctionDoc.__init__(self, obj, doc=doc, config=config)
|
| 198 |
+
|
| 199 |
+
class SphinxClassDoc(SphinxDocString, ClassDoc):
|
| 200 |
+
def __init__(self, obj, doc=None, func_doc=None, config={}):
|
| 201 |
+
self.use_plots = config.get('use_plots', False)
|
| 202 |
+
ClassDoc.__init__(self, obj, doc=doc, func_doc=None, config=config)
|
| 203 |
+
|
| 204 |
+
class SphinxObjDoc(SphinxDocString):
|
| 205 |
+
def __init__(self, obj, doc=None, config={}):
|
| 206 |
+
self._f = obj
|
| 207 |
+
SphinxDocString.__init__(self, doc, config=config)
|
| 208 |
+
|
| 209 |
+
def get_doc_object(obj, what=None, doc=None, config={}):
|
| 210 |
+
if what is None:
|
| 211 |
+
if inspect.isclass(obj):
|
| 212 |
+
what = 'class'
|
| 213 |
+
elif inspect.ismodule(obj):
|
| 214 |
+
what = 'module'
|
| 215 |
+
elif callable(obj):
|
| 216 |
+
what = 'function'
|
| 217 |
+
else:
|
| 218 |
+
what = 'object'
|
| 219 |
+
if what == 'class':
|
| 220 |
+
return SphinxClassDoc(obj, func_doc=SphinxFunctionDoc, doc=doc,
|
| 221 |
+
config=config)
|
| 222 |
+
elif what in ('function', 'method'):
|
| 223 |
+
return SphinxFunctionDoc(obj, doc=doc, config=config)
|
| 224 |
+
else:
|
| 225 |
+
if doc is None:
|
| 226 |
+
doc = pydoc.getdoc(obj)
|
| 227 |
+
return SphinxObjDoc(obj, doc, config=config)
|
Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/sphinxext/github.py
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Define text roles for GitHub
|
| 2 |
+
|
| 3 |
+
* ghissue - Issue
|
| 4 |
+
* ghpull - Pull Request
|
| 5 |
+
* ghuser - User
|
| 6 |
+
|
| 7 |
+
Adapted from bitbucket example here:
|
| 8 |
+
https://bitbucket.org/birkenfeld/sphinx-contrib/src/tip/bitbucket/sphinxcontrib/bitbucket.py
|
| 9 |
+
|
| 10 |
+
Authors
|
| 11 |
+
-------
|
| 12 |
+
|
| 13 |
+
* Doug Hellmann
|
| 14 |
+
* Min RK
|
| 15 |
+
"""
|
| 16 |
+
#
|
| 17 |
+
# Original Copyright (c) 2010 Doug Hellmann. All rights reserved.
|
| 18 |
+
#
|
| 19 |
+
|
| 20 |
+
from docutils import nodes, utils
|
| 21 |
+
from docutils.parsers.rst.roles import set_classes
|
| 22 |
+
|
| 23 |
+
def make_link_node(rawtext, app, type, slug, options):
|
| 24 |
+
"""Create a link to a github resource.
|
| 25 |
+
|
| 26 |
+
:param rawtext: Text being replaced with link node.
|
| 27 |
+
:param app: Sphinx application context
|
| 28 |
+
:param type: Link type (issues, changeset, etc.)
|
| 29 |
+
:param slug: ID of the thing to link to
|
| 30 |
+
:param options: Options dictionary passed to role func.
|
| 31 |
+
"""
|
| 32 |
+
|
| 33 |
+
try:
|
| 34 |
+
base = app.config.github_project_url
|
| 35 |
+
if not base:
|
| 36 |
+
raise AttributeError
|
| 37 |
+
if not base.endswith('/'):
|
| 38 |
+
base += '/'
|
| 39 |
+
except AttributeError as err:
|
| 40 |
+
raise ValueError('github_project_url configuration value is not set (%s)' % str(err))
|
| 41 |
+
|
| 42 |
+
ref = base + type + '/' + slug + '/'
|
| 43 |
+
set_classes(options)
|
| 44 |
+
prefix = "#"
|
| 45 |
+
if type == 'pull':
|
| 46 |
+
prefix = "PR " + prefix
|
| 47 |
+
node = nodes.reference(rawtext, prefix + utils.unescape(slug), refuri=ref,
|
| 48 |
+
**options)
|
| 49 |
+
return node
|
| 50 |
+
|
| 51 |
+
def ghissue_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
|
| 52 |
+
"""Link to a GitHub issue.
|
| 53 |
+
|
| 54 |
+
Returns 2 part tuple containing list of nodes to insert into the
|
| 55 |
+
document and a list of system messages. Both are allowed to be
|
| 56 |
+
empty.
|
| 57 |
+
|
| 58 |
+
:param name: The role name used in the document.
|
| 59 |
+
:param rawtext: The entire markup snippet, with role.
|
| 60 |
+
:param text: The text marked with the role.
|
| 61 |
+
:param lineno: The line number where rawtext appears in the input.
|
| 62 |
+
:param inliner: The inliner instance that called us.
|
| 63 |
+
:param options: Directive options for customization.
|
| 64 |
+
:param content: The directive content for customization.
|
| 65 |
+
"""
|
| 66 |
+
|
| 67 |
+
try:
|
| 68 |
+
issue_num = int(text)
|
| 69 |
+
if issue_num <= 0:
|
| 70 |
+
raise ValueError
|
| 71 |
+
except ValueError:
|
| 72 |
+
msg = inliner.reporter.error(
|
| 73 |
+
'GitHub issue number must be a number greater than or equal to 1; '
|
| 74 |
+
'"%s" is invalid.' % text, line=lineno)
|
| 75 |
+
prb = inliner.problematic(rawtext, rawtext, msg)
|
| 76 |
+
return [prb], [msg]
|
| 77 |
+
app = inliner.document.settings.env.app
|
| 78 |
+
#app.info('issue %r' % text)
|
| 79 |
+
if 'pull' in name.lower():
|
| 80 |
+
category = 'pull'
|
| 81 |
+
elif 'issue' in name.lower():
|
| 82 |
+
category = 'issues'
|
| 83 |
+
else:
|
| 84 |
+
msg = inliner.reporter.error(
|
| 85 |
+
'GitHub roles include "ghpull" and "ghissue", '
|
| 86 |
+
'"%s" is invalid.' % name, line=lineno)
|
| 87 |
+
prb = inliner.problematic(rawtext, rawtext, msg)
|
| 88 |
+
return [prb], [msg]
|
| 89 |
+
node = make_link_node(rawtext, app, category, str(issue_num), options)
|
| 90 |
+
return [node], []
|
| 91 |
+
|
| 92 |
+
def ghuser_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
|
| 93 |
+
"""Link to a GitHub user.
|
| 94 |
+
|
| 95 |
+
Returns 2 part tuple containing list of nodes to insert into the
|
| 96 |
+
document and a list of system messages. Both are allowed to be
|
| 97 |
+
empty.
|
| 98 |
+
|
| 99 |
+
:param name: The role name used in the document.
|
| 100 |
+
:param rawtext: The entire markup snippet, with role.
|
| 101 |
+
:param text: The text marked with the role.
|
| 102 |
+
:param lineno: The line number where rawtext appears in the input.
|
| 103 |
+
:param inliner: The inliner instance that called us.
|
| 104 |
+
:param options: Directive options for customization.
|
| 105 |
+
:param content: The directive content for customization.
|
| 106 |
+
"""
|
| 107 |
+
app = inliner.document.settings.env.app
|
| 108 |
+
#app.info('user link %r' % text)
|
| 109 |
+
ref = 'https://www.github.com/' + text
|
| 110 |
+
node = nodes.reference(rawtext, text, refuri=ref, **options)
|
| 111 |
+
return [node], []
|
| 112 |
+
|
| 113 |
+
def ghcommit_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
|
| 114 |
+
"""Link to a GitHub commit.
|
| 115 |
+
|
| 116 |
+
Returns 2 part tuple containing list of nodes to insert into the
|
| 117 |
+
document and a list of system messages. Both are allowed to be
|
| 118 |
+
empty.
|
| 119 |
+
|
| 120 |
+
:param name: The role name used in the document.
|
| 121 |
+
:param rawtext: The entire markup snippet, with role.
|
| 122 |
+
:param text: The text marked with the role.
|
| 123 |
+
:param lineno: The line number where rawtext appears in the input.
|
| 124 |
+
:param inliner: The inliner instance that called us.
|
| 125 |
+
:param options: Directive options for customization.
|
| 126 |
+
:param content: The directive content for customization.
|
| 127 |
+
"""
|
| 128 |
+
app = inliner.document.settings.env.app
|
| 129 |
+
#app.info('user link %r' % text)
|
| 130 |
+
try:
|
| 131 |
+
base = app.config.github_project_url
|
| 132 |
+
if not base:
|
| 133 |
+
raise AttributeError
|
| 134 |
+
if not base.endswith('/'):
|
| 135 |
+
base += '/'
|
| 136 |
+
except AttributeError as err:
|
| 137 |
+
raise ValueError('github_project_url configuration value is not set (%s)' % str(err))
|
| 138 |
+
|
| 139 |
+
ref = base + text
|
| 140 |
+
node = nodes.reference(rawtext, text[:6], refuri=ref, **options)
|
| 141 |
+
return [node], []
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
def setup(app):
|
| 145 |
+
"""Install the plugin.
|
| 146 |
+
|
| 147 |
+
:param app: Sphinx application context.
|
| 148 |
+
"""
|
| 149 |
+
app.info('Initializing GitHub plugin')
|
| 150 |
+
app.add_role('ghissue', ghissue_role)
|
| 151 |
+
app.add_role('ghpull', ghissue_role)
|
| 152 |
+
app.add_role('ghuser', ghuser_role)
|
| 153 |
+
app.add_role('ghcommit', ghcommit_role)
|
| 154 |
+
app.add_config_value('github_project_url', None, 'env')
|
| 155 |
+
return
|
Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/sphinxext/math_dollar.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import re
|
| 2 |
+
|
| 3 |
+
def dollars_to_math(source):
|
| 4 |
+
r"""
|
| 5 |
+
Replace dollar signs with backticks.
|
| 6 |
+
|
| 7 |
+
More precisely, do a regular expression search. Replace a plain
|
| 8 |
+
dollar sign ($) by a backtick (`). Replace an escaped dollar sign
|
| 9 |
+
(\$) by a dollar sign ($). Don't change a dollar sign preceded or
|
| 10 |
+
followed by a backtick (`$ or $`), because of strings like
|
| 11 |
+
"``$HOME``". Don't make any changes on lines starting with
|
| 12 |
+
spaces, because those are indented and hence part of a block of
|
| 13 |
+
code or examples.
|
| 14 |
+
|
| 15 |
+
This also doesn't replaces dollar signs enclosed in curly braces,
|
| 16 |
+
to avoid nested math environments, such as ::
|
| 17 |
+
|
| 18 |
+
$f(n) = 0 \text{ if $n$ is prime}$
|
| 19 |
+
|
| 20 |
+
Thus the above line would get changed to
|
| 21 |
+
|
| 22 |
+
`f(n) = 0 \text{ if $n$ is prime}`
|
| 23 |
+
"""
|
| 24 |
+
s = "\n".join(source)
|
| 25 |
+
if s.find("$") == -1:
|
| 26 |
+
return
|
| 27 |
+
# This searches for "$blah$" inside a pair of curly braces --
|
| 28 |
+
# don't change these, since they're probably coming from a nested
|
| 29 |
+
# math environment. So for each match, we replace it with a temporary
|
| 30 |
+
# string, and later on we substitute the original back.
|
| 31 |
+
global _data
|
| 32 |
+
_data = {}
|
| 33 |
+
def repl(matchobj):
|
| 34 |
+
global _data
|
| 35 |
+
s = matchobj.group(0)
|
| 36 |
+
t = "___XXX_REPL_%d___" % len(_data)
|
| 37 |
+
_data[t] = s
|
| 38 |
+
return t
|
| 39 |
+
s = re.sub(r"({[^{}$]*\$[^{}$]*\$[^{}]*})", repl, s)
|
| 40 |
+
# matches $...$
|
| 41 |
+
dollars = re.compile(r"(?<!\$)(?<!\\)\$([^\$]+?)\$")
|
| 42 |
+
# regular expression for \$
|
| 43 |
+
slashdollar = re.compile(r"\\\$")
|
| 44 |
+
s = dollars.sub(r":math:`\1`", s)
|
| 45 |
+
s = slashdollar.sub(r"$", s)
|
| 46 |
+
# change the original {...} things in:
|
| 47 |
+
for r in _data:
|
| 48 |
+
s = s.replace(r, _data[r])
|
| 49 |
+
# now save results in "source"
|
| 50 |
+
source[:] = [s]
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def process_dollars(app, docname, source):
|
| 54 |
+
dollars_to_math(source)
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def mathdollar_docstrings(app, what, name, obj, options, lines):
|
| 58 |
+
dollars_to_math(lines)
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def setup(app):
|
| 62 |
+
app.connect("source-read", process_dollars)
|
| 63 |
+
app.connect('autodoc-process-docstring', mathdollar_docstrings)
|
Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/sphinxext/numpydoc.py
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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inx extension that handles docstrings in the Numpy standard format. [1]
|
| 7 |
+
|
| 8 |
+
It will:
|
| 9 |
+
|
| 10 |
+
- Convert Parameters etc. sections to field lists.
|
| 11 |
+
- Convert See Also section to a See also entry.
|
| 12 |
+
- Renumber references.
|
| 13 |
+
- Extract the signature from the docstring, if it can't be determined
|
| 14 |
+
otherwise.
|
| 15 |
+
|
| 16 |
+
.. [1] https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt
|
| 17 |
+
|
| 18 |
+
"""
|
| 19 |
+
from __future__ import division, absolute_import, print_function
|
| 20 |
+
|
| 21 |
+
import sys
|
| 22 |
+
import re
|
| 23 |
+
import pydoc
|
| 24 |
+
import sphinx
|
| 25 |
+
import inspect
|
| 26 |
+
import collections
|
| 27 |
+
|
| 28 |
+
if sphinx.__version__ < '1.0.1':
|
| 29 |
+
raise RuntimeError("Sphinx 1.0.1 or newer is required")
|
| 30 |
+
|
| 31 |
+
from docscrape_sphinx import get_doc_object, SphinxDocString
|
| 32 |
+
from sphinx.util.compat import Directive
|
| 33 |
+
|
| 34 |
+
if sys.version_info[0] >= 3:
|
| 35 |
+
sixu = lambda s: s
|
| 36 |
+
else:
|
| 37 |
+
sixu = lambda s: unicode(s, 'unicode_escape')
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def mangle_docstrings(app, what, name, obj, options, lines,
|
| 41 |
+
reference_offset=[0]):
|
| 42 |
+
|
| 43 |
+
cfg = {'use_plots': app.config.numpydoc_use_plots,
|
| 44 |
+
'show_class_members': app.config.numpydoc_show_class_members,
|
| 45 |
+
'show_inherited_class_members':
|
| 46 |
+
app.config.numpydoc_show_inherited_class_members,
|
| 47 |
+
'class_members_toctree': app.config.numpydoc_class_members_toctree}
|
| 48 |
+
|
| 49 |
+
u_NL = sixu('\n')
|
| 50 |
+
if what == 'module':
|
| 51 |
+
# Strip top title
|
| 52 |
+
pattern = '^\\s*[#*=]{4,}\\n[a-z0-9 -]+\\n[#*=]{4,}\\s*'
|
| 53 |
+
title_re = re.compile(sixu(pattern), re.I | re.S)
|
| 54 |
+
lines[:] = title_re.sub(sixu(''), u_NL.join(lines)).split(u_NL)
|
| 55 |
+
else:
|
| 56 |
+
doc = get_doc_object(obj, what, u_NL.join(lines), config=cfg)
|
| 57 |
+
if sys.version_info[0] >= 3:
|
| 58 |
+
doc = str(doc)
|
| 59 |
+
else:
|
| 60 |
+
doc = unicode(doc)
|
| 61 |
+
lines[:] = doc.split(u_NL)
|
| 62 |
+
|
| 63 |
+
if (app.config.numpydoc_edit_link and hasattr(obj, '__name__') and
|
| 64 |
+
obj.__name__):
|
| 65 |
+
if hasattr(obj, '__module__'):
|
| 66 |
+
v = dict(full_name=sixu("%s.%s") % (obj.__module__, obj.__name__))
|
| 67 |
+
else:
|
| 68 |
+
v = dict(full_name=obj.__name__)
|
| 69 |
+
lines += [sixu(''), sixu('.. htmlonly::'), sixu('')]
|
| 70 |
+
lines += [sixu(' %s') % x for x in
|
| 71 |
+
(app.config.numpydoc_edit_link % v).split("\n")]
|
| 72 |
+
|
| 73 |
+
# replace reference numbers so that there are no duplicates
|
| 74 |
+
references = []
|
| 75 |
+
for line in lines:
|
| 76 |
+
line = line.strip()
|
| 77 |
+
m = re.match(sixu('^.. \\[([a-z0-9_.-])\\]'), line, re.I)
|
| 78 |
+
if m:
|
| 79 |
+
references.append(m.group(1))
|
| 80 |
+
|
| 81 |
+
# start renaming from the longest string, to avoid overwriting parts
|
| 82 |
+
references.sort(key=lambda x: -len(x))
|
| 83 |
+
if references:
|
| 84 |
+
for i, line in enumerate(lines):
|
| 85 |
+
for r in references:
|
| 86 |
+
if re.match(sixu('^\\d+$'), r):
|
| 87 |
+
new_r = sixu("R%d") % (reference_offset[0] + int(r))
|
| 88 |
+
else:
|
| 89 |
+
new_r = sixu("%s%d") % (r, reference_offset[0])
|
| 90 |
+
lines[i] = lines[i].replace(sixu('[%s]_') % r,
|
| 91 |
+
sixu('[%s]_') % new_r)
|
| 92 |
+
lines[i] = lines[i].replace(sixu('.. [%s]') % r,
|
| 93 |
+
sixu('.. [%s]') % new_r)
|
| 94 |
+
|
| 95 |
+
reference_offset[0] += len(references)
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def mangle_signature(app, what, name, obj, options, sig, retann):
|
| 99 |
+
# Do not try to inspect classes that don't define `__init__`
|
| 100 |
+
if (inspect.isclass(obj) and
|
| 101 |
+
(not hasattr(obj, '__init__') or
|
| 102 |
+
'initializes x; see ' in pydoc.getdoc(obj.__init__))):
|
| 103 |
+
return '', ''
|
| 104 |
+
|
| 105 |
+
if not (isinstance(obj, collections.Callable) or
|
| 106 |
+
hasattr(obj, '__argspec_is_invalid_')):
|
| 107 |
+
return
|
| 108 |
+
|
| 109 |
+
if not hasattr(obj, '__doc__'):
|
| 110 |
+
return
|
| 111 |
+
|
| 112 |
+
doc = SphinxDocString(pydoc.getdoc(obj))
|
| 113 |
+
if doc['Signature']:
|
| 114 |
+
sig = re.sub(sixu("^[^(]*"), sixu(""), doc['Signature'])
|
| 115 |
+
return sig, sixu('')
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
def setup(app, get_doc_object_=get_doc_object):
|
| 119 |
+
if not hasattr(app, 'add_config_value'):
|
| 120 |
+
return # probably called by nose, better bail out
|
| 121 |
+
|
| 122 |
+
global get_doc_object
|
| 123 |
+
get_doc_object = get_doc_object_
|
| 124 |
+
|
| 125 |
+
app.connect('autodoc-process-docstring', mangle_docstrings)
|
| 126 |
+
app.connect('autodoc-process-signature', mangle_signature)
|
| 127 |
+
app.add_config_value('numpydoc_edit_link', None, False)
|
| 128 |
+
app.add_config_value('numpydoc_use_plots', None, False)
|
| 129 |
+
app.add_config_value('numpydoc_show_class_members', True, True)
|
| 130 |
+
app.add_config_value('numpydoc_show_inherited_class_members', True, True)
|
| 131 |
+
app.add_config_value('numpydoc_class_members_toctree', True, True)
|
| 132 |
+
|
| 133 |
+
# Extra mangling domains
|
| 134 |
+
app.add_domain(NumpyPythonDomain)
|
| 135 |
+
app.add_domain(NumpyCDomain)
|
| 136 |
+
|
| 137 |
+
# ------------------------------------------------------------------------------
|
| 138 |
+
# Docstring-mangling domains
|
| 139 |
+
# ------------------------------------------------------------------------------
|
| 140 |
+
|
| 141 |
+
from docutils.statemachine import ViewList
|
| 142 |
+
from sphinx.domains.c import CDomain
|
| 143 |
+
from sphinx.domains.python import PythonDomain
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
class ManglingDomainBase(object):
|
| 147 |
+
directive_mangling_map = {}
|
| 148 |
+
|
| 149 |
+
def __init__(self, *a, **kw):
|
| 150 |
+
super(ManglingDomainBase, self).__init__(*a, **kw)
|
| 151 |
+
self.wrap_mangling_directives()
|
| 152 |
+
|
| 153 |
+
def wrap_mangling_directives(self):
|
| 154 |
+
for name, objtype in list(self.directive_mangling_map.items()):
|
| 155 |
+
self.directives[name] = wrap_mangling_directive(
|
| 156 |
+
self.directives[name], objtype)
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
class NumpyPythonDomain(ManglingDomainBase, PythonDomain):
|
| 160 |
+
name = 'np'
|
| 161 |
+
directive_mangling_map = {
|
| 162 |
+
'function': 'function',
|
| 163 |
+
'class': 'class',
|
| 164 |
+
'exception': 'class',
|
| 165 |
+
'method': 'function',
|
| 166 |
+
'classmethod': 'function',
|
| 167 |
+
'staticmethod': 'function',
|
| 168 |
+
'attribute': 'attribute',
|
| 169 |
+
}
|
| 170 |
+
indices = []
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
class NumpyCDomain(ManglingDomainBase, CDomain):
|
| 174 |
+
name = 'np-c'
|
| 175 |
+
directive_mangling_map = {
|
| 176 |
+
'function': 'function',
|
| 177 |
+
'member': 'attribute',
|
| 178 |
+
'macro': 'function',
|
| 179 |
+
'type': 'class',
|
| 180 |
+
'var': 'object',
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
def wrap_mangling_directive(base_directive, objtype):
|
| 185 |
+
class directive(base_directive):
|
| 186 |
+
def run(self):
|
| 187 |
+
env = self.state.document.settings.env
|
| 188 |
+
|
| 189 |
+
name = None
|
| 190 |
+
if self.arguments:
|
| 191 |
+
m = re.match(r'^(.*\s+)?(.*?)(\(.*)?', self.arguments[0])
|
| 192 |
+
name = m.group(2).strip()
|
| 193 |
+
|
| 194 |
+
if not name:
|
| 195 |
+
name = self.arguments[0]
|
| 196 |
+
|
| 197 |
+
lines = list(self.content)
|
| 198 |
+
mangle_docstrings(env.app, objtype, name, None, None, lines)
|
| 199 |
+
self.content = ViewList(lines, self.content.parent)
|
| 200 |
+
|
| 201 |
+
return base_directive.run(self)
|
| 202 |
+
|
| 203 |
+
return directive
|
Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/tools/LICENSE.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
These files were obtained from
|
| 2 |
+
|
| 3 |
+
https://www.mail-archive.com/sphinx-dev@googlegroups.com/msg02472.html
|
| 4 |
+
|
| 5 |
+
and were released under a BSD/MIT license by Fernando Perez, Matthew Brett and
|
| 6 |
+
the PyMVPA folks. Further cleanups by the scikit-image crew.
|
| 7 |
+
|
Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/tools/apigen.py
ADDED
|
@@ -0,0 +1,509 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Attempt to generate templates for module reference with Sphinx
|
| 3 |
+
|
| 4 |
+
To include extension modules, first identify them as valid in the
|
| 5 |
+
``_uri2path`` method, then handle them in the ``_parse_module_with_import``
|
| 6 |
+
script.
|
| 7 |
+
|
| 8 |
+
Notes
|
| 9 |
+
-----
|
| 10 |
+
This parsing is based on import and introspection of modules.
|
| 11 |
+
Previously functions and classes were found by parsing the text of .py files.
|
| 12 |
+
|
| 13 |
+
Extension modules should be discovered and included as well.
|
| 14 |
+
|
| 15 |
+
This is a modified version of a script originally shipped with the PyMVPA
|
| 16 |
+
project, then adapted for use first in NIPY and then in skimage. PyMVPA
|
| 17 |
+
is an MIT-licensed project.
|
| 18 |
+
"""
|
| 19 |
+
|
| 20 |
+
# Stdlib imports
|
| 21 |
+
import os
|
| 22 |
+
import re
|
| 23 |
+
from inspect import getmodule
|
| 24 |
+
|
| 25 |
+
from types import BuiltinFunctionType, FunctionType
|
| 26 |
+
|
| 27 |
+
# suppress print statements (warnings for empty files)
|
| 28 |
+
DEBUG = True
|
| 29 |
+
|
| 30 |
+
class ApiDocWriter(object):
|
| 31 |
+
''' Class for automatic detection and parsing of API docs
|
| 32 |
+
to Sphinx-parsable reST format'''
|
| 33 |
+
|
| 34 |
+
# only separating first two levels
|
| 35 |
+
rst_section_levels = ['*', '=', '-', '~', '^']
|
| 36 |
+
|
| 37 |
+
def __init__(self,
|
| 38 |
+
package_name,
|
| 39 |
+
rst_extension='.txt',
|
| 40 |
+
package_skip_patterns=None,
|
| 41 |
+
module_skip_patterns=None,
|
| 42 |
+
other_defines = True
|
| 43 |
+
):
|
| 44 |
+
''' Initialize package for parsing
|
| 45 |
+
|
| 46 |
+
Parameters
|
| 47 |
+
----------
|
| 48 |
+
package_name : string
|
| 49 |
+
Name of the top-level package. *package_name* must be the
|
| 50 |
+
name of an importable package
|
| 51 |
+
rst_extension : string, optional
|
| 52 |
+
Extension for reST files, default '.rst'
|
| 53 |
+
package_skip_patterns : None or sequence of {strings, regexps}
|
| 54 |
+
Sequence of strings giving URIs of packages to be excluded
|
| 55 |
+
Operates on the package path, starting at (including) the
|
| 56 |
+
first dot in the package path, after *package_name* - so,
|
| 57 |
+
if *package_name* is ``sphinx``, then ``sphinx.util`` will
|
| 58 |
+
result in ``.util`` being passed for searching by these
|
| 59 |
+
regexps. If is None, gives default. Default is:
|
| 60 |
+
['\.tests$']
|
| 61 |
+
module_skip_patterns : None or sequence
|
| 62 |
+
Sequence of strings giving URIs of modules to be excluded
|
| 63 |
+
Operates on the module name including preceding URI path,
|
| 64 |
+
back to the first dot after *package_name*. For example
|
| 65 |
+
``sphinx.util.console`` results in the string to search of
|
| 66 |
+
``.util.console``
|
| 67 |
+
If is None, gives default. Default is:
|
| 68 |
+
['\.setup$', '\._']
|
| 69 |
+
other_defines : {True, False}, optional
|
| 70 |
+
Whether to include classes and functions that are imported in a
|
| 71 |
+
particular module but not defined there.
|
| 72 |
+
'''
|
| 73 |
+
if package_skip_patterns is None:
|
| 74 |
+
package_skip_patterns = ['\\.tests$']
|
| 75 |
+
if module_skip_patterns is None:
|
| 76 |
+
module_skip_patterns = ['\\.setup$', '\\._']
|
| 77 |
+
self.package_name = package_name
|
| 78 |
+
self.rst_extension = rst_extension
|
| 79 |
+
self.package_skip_patterns = package_skip_patterns
|
| 80 |
+
self.module_skip_patterns = module_skip_patterns
|
| 81 |
+
self.other_defines = other_defines
|
| 82 |
+
|
| 83 |
+
def get_package_name(self):
|
| 84 |
+
return self._package_name
|
| 85 |
+
|
| 86 |
+
def set_package_name(self, package_name):
|
| 87 |
+
''' Set package_name
|
| 88 |
+
|
| 89 |
+
>>> docwriter = ApiDocWriter('sphinx')
|
| 90 |
+
>>> import sphinx
|
| 91 |
+
>>> docwriter.root_path == sphinx.__path__[0]
|
| 92 |
+
True
|
| 93 |
+
>>> docwriter.package_name = 'docutils'
|
| 94 |
+
>>> import docutils
|
| 95 |
+
>>> docwriter.root_path == docutils.__path__[0]
|
| 96 |
+
True
|
| 97 |
+
'''
|
| 98 |
+
# It's also possible to imagine caching the module parsing here
|
| 99 |
+
self._package_name = package_name
|
| 100 |
+
root_module = self._import(package_name)
|
| 101 |
+
self.root_path = root_module.__path__[-1]
|
| 102 |
+
self.written_modules = None
|
| 103 |
+
|
| 104 |
+
package_name = property(get_package_name, set_package_name, None,
|
| 105 |
+
'get/set package_name')
|
| 106 |
+
|
| 107 |
+
def _import(self, name):
|
| 108 |
+
''' Import namespace package '''
|
| 109 |
+
mod = __import__(name)
|
| 110 |
+
components = name.split('.')
|
| 111 |
+
for comp in components[1:]:
|
| 112 |
+
mod = getattr(mod, comp)
|
| 113 |
+
return mod
|
| 114 |
+
|
| 115 |
+
def _get_object_name(self, line):
|
| 116 |
+
''' Get second token in line
|
| 117 |
+
>>> docwriter = ApiDocWriter('sphinx')
|
| 118 |
+
>>> docwriter._get_object_name(" def func(): ")
|
| 119 |
+
'func'
|
| 120 |
+
>>> docwriter._get_object_name(" class Klass(object): ")
|
| 121 |
+
'Klass'
|
| 122 |
+
>>> docwriter._get_object_name(" class Klass: ")
|
| 123 |
+
'Klass'
|
| 124 |
+
'''
|
| 125 |
+
name = line.split()[1].split('(')[0].strip()
|
| 126 |
+
# in case we have classes which are not derived from object
|
| 127 |
+
# ie. old style classes
|
| 128 |
+
return name.rstrip(':')
|
| 129 |
+
|
| 130 |
+
def _uri2path(self, uri):
|
| 131 |
+
''' Convert uri to absolute filepath
|
| 132 |
+
|
| 133 |
+
Parameters
|
| 134 |
+
----------
|
| 135 |
+
uri : string
|
| 136 |
+
URI of python module to return path for
|
| 137 |
+
|
| 138 |
+
Returns
|
| 139 |
+
-------
|
| 140 |
+
path : None or string
|
| 141 |
+
Returns None if there is no valid path for this URI
|
| 142 |
+
Otherwise returns absolute file system path for URI
|
| 143 |
+
|
| 144 |
+
Examples
|
| 145 |
+
--------
|
| 146 |
+
>>> docwriter = ApiDocWriter('sphinx')
|
| 147 |
+
>>> import sphinx
|
| 148 |
+
>>> modpath = sphinx.__path__[0]
|
| 149 |
+
>>> res = docwriter._uri2path('sphinx.builder')
|
| 150 |
+
>>> res == os.path.join(modpath, 'builder.py')
|
| 151 |
+
True
|
| 152 |
+
>>> res = docwriter._uri2path('sphinx')
|
| 153 |
+
>>> res == os.path.join(modpath, '__init__.py')
|
| 154 |
+
True
|
| 155 |
+
>>> docwriter._uri2path('sphinx.does_not_exist')
|
| 156 |
+
|
| 157 |
+
'''
|
| 158 |
+
if uri == self.package_name:
|
| 159 |
+
return os.path.join(self.root_path, '__init__.py')
|
| 160 |
+
path = uri.replace(self.package_name + '.', '')
|
| 161 |
+
path = path.replace('.', os.path.sep)
|
| 162 |
+
path = os.path.join(self.root_path, path)
|
| 163 |
+
# XXX maybe check for extensions as well?
|
| 164 |
+
if os.path.exists(path + '.py'): # file
|
| 165 |
+
path += '.py'
|
| 166 |
+
elif os.path.exists(os.path.join(path, '__init__.py')):
|
| 167 |
+
path = os.path.join(path, '__init__.py')
|
| 168 |
+
else:
|
| 169 |
+
return None
|
| 170 |
+
return path
|
| 171 |
+
|
| 172 |
+
def _path2uri(self, dirpath):
|
| 173 |
+
''' Convert directory path to uri '''
|
| 174 |
+
package_dir = self.package_name.replace('.', os.path.sep)
|
| 175 |
+
relpath = dirpath.replace(self.root_path, package_dir)
|
| 176 |
+
if relpath.startswith(os.path.sep):
|
| 177 |
+
relpath = relpath[1:]
|
| 178 |
+
return relpath.replace(os.path.sep, '.')
|
| 179 |
+
|
| 180 |
+
def _parse_module(self, uri):
|
| 181 |
+
''' Parse module defined in *uri* '''
|
| 182 |
+
filename = self._uri2path(uri)
|
| 183 |
+
if filename is None:
|
| 184 |
+
print(filename, 'erk')
|
| 185 |
+
# nothing that we could handle here.
|
| 186 |
+
return ([],[])
|
| 187 |
+
|
| 188 |
+
f = open(filename, 'rt')
|
| 189 |
+
functions, classes = self._parse_lines(f)
|
| 190 |
+
f.close()
|
| 191 |
+
return functions, classes
|
| 192 |
+
|
| 193 |
+
def _parse_module_with_import(self, uri):
|
| 194 |
+
"""Look for functions and classes in an importable module.
|
| 195 |
+
|
| 196 |
+
Parameters
|
| 197 |
+
----------
|
| 198 |
+
uri : str
|
| 199 |
+
The name of the module to be parsed. This module needs to be
|
| 200 |
+
importable.
|
| 201 |
+
|
| 202 |
+
Returns
|
| 203 |
+
-------
|
| 204 |
+
functions : list of str
|
| 205 |
+
A list of (public) function names in the module.
|
| 206 |
+
classes : list of str
|
| 207 |
+
A list of (public) class names in the module.
|
| 208 |
+
"""
|
| 209 |
+
mod = __import__(uri, fromlist=[uri])
|
| 210 |
+
# find all public objects in the module.
|
| 211 |
+
obj_strs = [obj for obj in dir(mod) if not obj.startswith('_')]
|
| 212 |
+
functions = []
|
| 213 |
+
classes = []
|
| 214 |
+
for obj_str in obj_strs:
|
| 215 |
+
# find the actual object from its string representation
|
| 216 |
+
if obj_str not in mod.__dict__:
|
| 217 |
+
continue
|
| 218 |
+
obj = mod.__dict__[obj_str]
|
| 219 |
+
# Check if function / class defined in module
|
| 220 |
+
if not self.other_defines and not getmodule(obj) == mod:
|
| 221 |
+
continue
|
| 222 |
+
# figure out if obj is a function or class
|
| 223 |
+
if hasattr(obj, 'func_name') or \
|
| 224 |
+
isinstance(obj, BuiltinFunctionType) or \
|
| 225 |
+
isinstance(obj, FunctionType):
|
| 226 |
+
functions.append(obj_str)
|
| 227 |
+
else:
|
| 228 |
+
try:
|
| 229 |
+
issubclass(obj, object)
|
| 230 |
+
classes.append(obj_str)
|
| 231 |
+
except TypeError:
|
| 232 |
+
# not a function or class
|
| 233 |
+
pass
|
| 234 |
+
return functions, classes
|
| 235 |
+
|
| 236 |
+
def _parse_lines(self, linesource):
|
| 237 |
+
''' Parse lines of text for functions and classes '''
|
| 238 |
+
functions = []
|
| 239 |
+
classes = []
|
| 240 |
+
for line in linesource:
|
| 241 |
+
if line.startswith('def ') and line.count('('):
|
| 242 |
+
# exclude private stuff
|
| 243 |
+
name = self._get_object_name(line)
|
| 244 |
+
if not name.startswith('_'):
|
| 245 |
+
functions.append(name)
|
| 246 |
+
elif line.startswith('class '):
|
| 247 |
+
# exclude private stuff
|
| 248 |
+
name = self._get_object_name(line)
|
| 249 |
+
if not name.startswith('_'):
|
| 250 |
+
classes.append(name)
|
| 251 |
+
else:
|
| 252 |
+
pass
|
| 253 |
+
functions.sort()
|
| 254 |
+
classes.sort()
|
| 255 |
+
return functions, classes
|
| 256 |
+
|
| 257 |
+
def generate_api_doc(self, uri):
|
| 258 |
+
'''Make autodoc documentation template string for a module
|
| 259 |
+
|
| 260 |
+
Parameters
|
| 261 |
+
----------
|
| 262 |
+
uri : string
|
| 263 |
+
python location of module - e.g 'sphinx.builder'
|
| 264 |
+
|
| 265 |
+
Returns
|
| 266 |
+
-------
|
| 267 |
+
head : string
|
| 268 |
+
Module name, table of contents.
|
| 269 |
+
body : string
|
| 270 |
+
Function and class docstrings.
|
| 271 |
+
'''
|
| 272 |
+
# get the names of all classes and functions
|
| 273 |
+
functions, classes = self._parse_module_with_import(uri)
|
| 274 |
+
if not len(functions) and not len(classes) and DEBUG:
|
| 275 |
+
print('WARNING: Empty -', uri) # dbg
|
| 276 |
+
|
| 277 |
+
# Make a shorter version of the uri that omits the package name for
|
| 278 |
+
# titles
|
| 279 |
+
uri_short = re.sub(r'^%s\.' % self.package_name,'',uri)
|
| 280 |
+
|
| 281 |
+
head = '.. AUTO-GENERATED FILE -- DO NOT EDIT!\n\n'
|
| 282 |
+
body = ''
|
| 283 |
+
|
| 284 |
+
# Set the chapter title to read 'module' for all modules except for the
|
| 285 |
+
# main packages
|
| 286 |
+
if '.' in uri_short:
|
| 287 |
+
title = 'Module: :mod:`' + uri_short + '`'
|
| 288 |
+
head += title + '\n' + self.rst_section_levels[2] * len(title)
|
| 289 |
+
else:
|
| 290 |
+
title = ':mod:`' + uri_short + '`'
|
| 291 |
+
head += title + '\n' + self.rst_section_levels[1] * len(title)
|
| 292 |
+
|
| 293 |
+
head += '\n.. automodule:: ' + uri + '\n'
|
| 294 |
+
head += '\n.. currentmodule:: ' + uri + '\n'
|
| 295 |
+
body += '\n.. currentmodule:: ' + uri + '\n\n'
|
| 296 |
+
for c in classes:
|
| 297 |
+
body += '\n:class:`' + c + '`\n' \
|
| 298 |
+
+ self.rst_section_levels[3] * \
|
| 299 |
+
(len(c)+9) + '\n\n'
|
| 300 |
+
body += '\n.. autoclass:: ' + c + '\n'
|
| 301 |
+
# must NOT exclude from index to keep cross-refs working
|
| 302 |
+
body += ' :members:\n' \
|
| 303 |
+
' :undoc-members:\n' \
|
| 304 |
+
' :show-inheritance:\n' \
|
| 305 |
+
'\n' \
|
| 306 |
+
' .. automethod:: __init__\n\n'
|
| 307 |
+
head += '.. autosummary::\n\n'
|
| 308 |
+
for f in classes + functions:
|
| 309 |
+
head += ' ' + f + '\n'
|
| 310 |
+
head += '\n'
|
| 311 |
+
|
| 312 |
+
for f in functions:
|
| 313 |
+
# must NOT exclude from index to keep cross-refs working
|
| 314 |
+
body += f + '\n'
|
| 315 |
+
body += self.rst_section_levels[3] * len(f) + '\n'
|
| 316 |
+
body += '\n.. autofunction:: ' + f + '\n\n'
|
| 317 |
+
|
| 318 |
+
return head, body
|
| 319 |
+
|
| 320 |
+
def _survives_exclude(self, matchstr, match_type):
|
| 321 |
+
''' Returns True if *matchstr* does not match patterns
|
| 322 |
+
|
| 323 |
+
``self.package_name`` removed from front of string if present
|
| 324 |
+
|
| 325 |
+
Examples
|
| 326 |
+
--------
|
| 327 |
+
>>> dw = ApiDocWriter('sphinx')
|
| 328 |
+
>>> dw._survives_exclude('sphinx.okpkg', 'package')
|
| 329 |
+
True
|
| 330 |
+
>>> dw.package_skip_patterns.append('^\\.badpkg$')
|
| 331 |
+
>>> dw._survives_exclude('sphinx.badpkg', 'package')
|
| 332 |
+
False
|
| 333 |
+
>>> dw._survives_exclude('sphinx.badpkg', 'module')
|
| 334 |
+
True
|
| 335 |
+
>>> dw._survives_exclude('sphinx.badmod', 'module')
|
| 336 |
+
True
|
| 337 |
+
>>> dw.module_skip_patterns.append('^\\.badmod$')
|
| 338 |
+
>>> dw._survives_exclude('sphinx.badmod', 'module')
|
| 339 |
+
False
|
| 340 |
+
'''
|
| 341 |
+
if match_type == 'module':
|
| 342 |
+
patterns = self.module_skip_patterns
|
| 343 |
+
elif match_type == 'package':
|
| 344 |
+
patterns = self.package_skip_patterns
|
| 345 |
+
else:
|
| 346 |
+
raise ValueError('Cannot interpret match type "%s"'
|
| 347 |
+
% match_type)
|
| 348 |
+
# Match to URI without package name
|
| 349 |
+
L = len(self.package_name)
|
| 350 |
+
if matchstr[:L] == self.package_name:
|
| 351 |
+
matchstr = matchstr[L:]
|
| 352 |
+
for pat in patterns:
|
| 353 |
+
try:
|
| 354 |
+
pat.search
|
| 355 |
+
except AttributeError:
|
| 356 |
+
pat = re.compile(pat)
|
| 357 |
+
if pat.search(matchstr):
|
| 358 |
+
return False
|
| 359 |
+
|
| 360 |
+
return True
|
| 361 |
+
|
| 362 |
+
def discover_modules(self):
|
| 363 |
+
''' Return module sequence discovered from ``self.package_name``
|
| 364 |
+
|
| 365 |
+
|
| 366 |
+
Parameters
|
| 367 |
+
----------
|
| 368 |
+
None
|
| 369 |
+
|
| 370 |
+
Returns
|
| 371 |
+
-------
|
| 372 |
+
mods : sequence
|
| 373 |
+
Sequence of module names within ``self.package_name``
|
| 374 |
+
|
| 375 |
+
Examples
|
| 376 |
+
--------
|
| 377 |
+
>>> dw = ApiDocWriter('sphinx')
|
| 378 |
+
>>> mods = dw.discover_modules()
|
| 379 |
+
>>> 'sphinx.util' in mods
|
| 380 |
+
True
|
| 381 |
+
>>> dw.package_skip_patterns.append('\.util$')
|
| 382 |
+
>>> 'sphinx.util' in dw.discover_modules()
|
| 383 |
+
False
|
| 384 |
+
>>>
|
| 385 |
+
'''
|
| 386 |
+
modules = [self.package_name]
|
| 387 |
+
# raw directory parsing
|
| 388 |
+
for dirpath, dirnames, filenames in os.walk(self.root_path):
|
| 389 |
+
# Check directory names for packages
|
| 390 |
+
root_uri = self._path2uri(os.path.join(self.root_path,
|
| 391 |
+
dirpath))
|
| 392 |
+
|
| 393 |
+
# Normally, we'd only iterate over dirnames, but since
|
| 394 |
+
# dipy does not import a whole bunch of modules we'll
|
| 395 |
+
# include those here as well (the *.py filenames).
|
| 396 |
+
filenames = [f[:-3] for f in filenames if
|
| 397 |
+
f.endswith('.py') and not f.startswith('__init__')]
|
| 398 |
+
for filename in filenames:
|
| 399 |
+
package_uri = '/'.join((dirpath, filename))
|
| 400 |
+
|
| 401 |
+
for subpkg_name in dirnames + filenames:
|
| 402 |
+
package_uri = '.'.join((root_uri, subpkg_name))
|
| 403 |
+
package_path = self._uri2path(package_uri)
|
| 404 |
+
if (package_path and
|
| 405 |
+
self._survives_exclude(package_uri, 'package')):
|
| 406 |
+
modules.append(package_uri)
|
| 407 |
+
|
| 408 |
+
return sorted(modules)
|
| 409 |
+
|
| 410 |
+
def write_modules_api(self, modules, outdir):
|
| 411 |
+
# upper-level modules
|
| 412 |
+
main_module = modules[0].split('.')[0]
|
| 413 |
+
ulms = ['.'.join(m.split('.')[:2]) if m.count('.') >= 1
|
| 414 |
+
else m.split('.')[0] for m in modules]
|
| 415 |
+
|
| 416 |
+
from collections import OrderedDict
|
| 417 |
+
module_by_ulm = OrderedDict()
|
| 418 |
+
|
| 419 |
+
for v, k in zip(modules, ulms):
|
| 420 |
+
if k in module_by_ulm:
|
| 421 |
+
module_by_ulm[k].append(v)
|
| 422 |
+
else:
|
| 423 |
+
module_by_ulm[k] = [v]
|
| 424 |
+
|
| 425 |
+
written_modules = []
|
| 426 |
+
|
| 427 |
+
for ulm, mods in module_by_ulm.items():
|
| 428 |
+
print("Generating docs for %s:" % ulm)
|
| 429 |
+
document_head = []
|
| 430 |
+
document_body = []
|
| 431 |
+
|
| 432 |
+
for m in mods:
|
| 433 |
+
print(" -> " + m)
|
| 434 |
+
head, body = self.generate_api_doc(m)
|
| 435 |
+
|
| 436 |
+
document_head.append(head)
|
| 437 |
+
document_body.append(body)
|
| 438 |
+
|
| 439 |
+
out_module = ulm + self.rst_extension
|
| 440 |
+
outfile = os.path.join(outdir, out_module)
|
| 441 |
+
fileobj = open(outfile, 'wt')
|
| 442 |
+
|
| 443 |
+
fileobj.writelines(document_head + document_body)
|
| 444 |
+
fileobj.close()
|
| 445 |
+
written_modules.append(out_module)
|
| 446 |
+
|
| 447 |
+
self.written_modules = written_modules
|
| 448 |
+
|
| 449 |
+
def write_api_docs(self, outdir):
|
| 450 |
+
"""Generate API reST files.
|
| 451 |
+
|
| 452 |
+
Parameters
|
| 453 |
+
----------
|
| 454 |
+
outdir : string
|
| 455 |
+
Directory name in which to store files
|
| 456 |
+
We create automatic filenames for each module
|
| 457 |
+
|
| 458 |
+
Returns
|
| 459 |
+
-------
|
| 460 |
+
None
|
| 461 |
+
|
| 462 |
+
Notes
|
| 463 |
+
-----
|
| 464 |
+
Sets self.written_modules to list of written modules
|
| 465 |
+
"""
|
| 466 |
+
if not os.path.exists(outdir):
|
| 467 |
+
os.mkdir(outdir)
|
| 468 |
+
# compose list of modules
|
| 469 |
+
modules = self.discover_modules()
|
| 470 |
+
self.write_modules_api(modules,outdir)
|
| 471 |
+
|
| 472 |
+
def write_index(self, outdir, froot='gen', relative_to=None):
|
| 473 |
+
"""Make a reST API index file from written files
|
| 474 |
+
|
| 475 |
+
Parameters
|
| 476 |
+
----------
|
| 477 |
+
path : string
|
| 478 |
+
Filename to write index to
|
| 479 |
+
outdir : string
|
| 480 |
+
Directory to which to write generated index file
|
| 481 |
+
froot : string, optional
|
| 482 |
+
root (filename without extension) of filename to write to
|
| 483 |
+
Defaults to 'gen'. We add ``self.rst_extension``.
|
| 484 |
+
relative_to : string
|
| 485 |
+
path to which written filenames are relative. This
|
| 486 |
+
component of the written file path will be removed from
|
| 487 |
+
outdir, in the generated index. Default is None, meaning,
|
| 488 |
+
leave path as it is.
|
| 489 |
+
"""
|
| 490 |
+
if self.written_modules is None:
|
| 491 |
+
raise ValueError('No modules written')
|
| 492 |
+
# Get full filename path
|
| 493 |
+
path = os.path.join(outdir, froot+self.rst_extension)
|
| 494 |
+
# Path written into index is relative to rootpath
|
| 495 |
+
if relative_to is not None:
|
| 496 |
+
relpath = (outdir + os.path.sep).replace(relative_to + os.path.sep, '')
|
| 497 |
+
else:
|
| 498 |
+
relpath = outdir
|
| 499 |
+
idx = open(path,'wt')
|
| 500 |
+
w = idx.write
|
| 501 |
+
w('.. AUTO-GENERATED FILE -- DO NOT EDIT!\n\n')
|
| 502 |
+
|
| 503 |
+
title = "API Reference"
|
| 504 |
+
w(title + "\n")
|
| 505 |
+
w("=" * len(title) + "\n\n")
|
| 506 |
+
w('.. toctree::\n\n')
|
| 507 |
+
for f in self.written_modules:
|
| 508 |
+
w(' %s\n' % os.path.join(relpath,f))
|
| 509 |
+
idx.close()
|
Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/doc/tools/build_modref_templates.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
"""Script to auto-generate API docs.
|
| 3 |
+
"""
|
| 4 |
+
from __future__ import print_function, division
|
| 5 |
+
|
| 6 |
+
# stdlib imports
|
| 7 |
+
import sys
|
| 8 |
+
import re
|
| 9 |
+
from os.path import join as pjoin
|
| 10 |
+
|
| 11 |
+
# local imports
|
| 12 |
+
from apigen import ApiDocWriter
|
| 13 |
+
|
| 14 |
+
# version comparison
|
| 15 |
+
from distutils.version import LooseVersion as V
|
| 16 |
+
|
| 17 |
+
#*****************************************************************************
|
| 18 |
+
|
| 19 |
+
def abort(error):
|
| 20 |
+
print('*WARNING* API documentation not generated: %s' % error)
|
| 21 |
+
exit()
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
if __name__ == '__main__':
|
| 25 |
+
package = sys.argv[1]
|
| 26 |
+
outdir = sys.argv[2]
|
| 27 |
+
try:
|
| 28 |
+
other_defines = sys.argv[3]
|
| 29 |
+
except IndexError:
|
| 30 |
+
other_defines = True
|
| 31 |
+
else:
|
| 32 |
+
other_defines = other_defines in ('True', 'true', '1')
|
| 33 |
+
|
| 34 |
+
# Check that the package is available. If not, the API documentation is not
|
| 35 |
+
# (re)generated and existing API documentation sources will be used.
|
| 36 |
+
|
| 37 |
+
try:
|
| 38 |
+
__import__(package)
|
| 39 |
+
except ImportError:
|
| 40 |
+
abort("Can not import " + package)
|
| 41 |
+
|
| 42 |
+
module = sys.modules[package]
|
| 43 |
+
|
| 44 |
+
# Check that the source version is equal to the installed
|
| 45 |
+
# version. If the versions mismatch the API documentation sources
|
| 46 |
+
# are not (re)generated. This avoids automatic generation of documentation
|
| 47 |
+
# for older or newer versions if such versions are installed on the system.
|
| 48 |
+
|
| 49 |
+
installed_version = V(module.__version__)
|
| 50 |
+
|
| 51 |
+
ver_file = pjoin('..', package, 'version.py')
|
| 52 |
+
with open(ver_file) as f:
|
| 53 |
+
exec(f.read())
|
| 54 |
+
source_version = __version__
|
| 55 |
+
print('***', source_version)
|
| 56 |
+
|
| 57 |
+
if source_version != installed_version:
|
| 58 |
+
abort("Installed version does not match source version")
|
| 59 |
+
|
| 60 |
+
docwriter = ApiDocWriter(package, rst_extension='.rst',
|
| 61 |
+
other_defines=other_defines)
|
| 62 |
+
|
| 63 |
+
docwriter.package_skip_patterns += [r'\.pypcd$',
|
| 64 |
+
r'.*test.*$',
|
| 65 |
+
r'\.version.*$']
|
| 66 |
+
docwriter.write_api_docs(outdir)
|
| 67 |
+
docwriter.write_index(outdir, 'index', relative_to=outdir)
|
| 68 |
+
print('%d files written' % len(docwriter.written_modules))
|
Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/pypcd.egg-info/PKG-INFO
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: pypcd
|
| 3 |
+
Version: 0.1.1
|
| 4 |
+
Summary: Pure Python PCD reader/writer
|
| 5 |
+
Home-page: http://github.com/dimatura/pypcd
|
| 6 |
+
Download-URL:
|
| 7 |
+
Author: Daniel Maturana
|
| 8 |
+
Author-email: dimatura@cmu.edu
|
| 9 |
+
Maintainer: Daniel Maturana
|
| 10 |
+
Maintainer-email: dimatura@cmu.edu
|
| 11 |
+
License: MIT
|
| 12 |
+
Platform: OS Independent
|
| 13 |
+
Classifier: Development Status :: 3 - Alpha
|
| 14 |
+
Classifier: Environment :: Console
|
| 15 |
+
Classifier: Intended Audience :: Science/Research
|
| 16 |
+
Classifier: License :: OSI Approved :: MIT License
|
| 17 |
+
Classifier: Operating System :: OS Independent
|
| 18 |
+
Classifier: Programming Language :: Python
|
| 19 |
+
Classifier: Topic :: Scientific/Engineering
|
| 20 |
+
License-File: LICENSE
|
| 21 |
+
Requires-Dist: numpy
|
| 22 |
+
Requires-Dist: python-lzf
|
| 23 |
+
|
| 24 |
+
pypcd
|
| 25 |
+
========
|
| 26 |
+
|
| 27 |
+
Pure Python reader/writer for the PCL ``pcd`` data format for point clouds.
|
| 28 |
+
|
| 29 |
+
Please go to the repository README_.
|
| 30 |
+
|
| 31 |
+
.. _README: https://github.com/dimatura/pypcd/blob/master/README.md
|
| 32 |
+
|
| 33 |
+
License
|
| 34 |
+
=======
|
| 35 |
+
``pypcd`` is licensed under the terms of the MIT license. See the file
|
| 36 |
+
"LICENSE" for information on the history of this software, terms & conditions
|
| 37 |
+
for usage, and a DISCLAIMER OF ALL WARRANTIES.
|
| 38 |
+
|
| 39 |
+
All trademarks referenced herein are property of their respective holders.
|
| 40 |
+
|
| 41 |
+
Copyright (c) 2015--, Daniel Maturana
|
Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/pypcd.egg-info/SOURCES.txt
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
LICENSE
|
| 2 |
+
README.md
|
| 3 |
+
setup.py
|
| 4 |
+
pypcd/__init__.py
|
| 5 |
+
pypcd/nea_pc_format.py
|
| 6 |
+
pypcd/numpy_pc2.py
|
| 7 |
+
pypcd/pdutil.py
|
| 8 |
+
pypcd/pypcd.py
|
| 9 |
+
pypcd/sautil.py
|
| 10 |
+
pypcd/version.py
|
| 11 |
+
pypcd.egg-info/PKG-INFO
|
| 12 |
+
pypcd.egg-info/SOURCES.txt
|
| 13 |
+
pypcd.egg-info/dependency_links.txt
|
| 14 |
+
pypcd.egg-info/requires.txt
|
| 15 |
+
pypcd.egg-info/top_level.txt
|
| 16 |
+
pypcd/tests/__init__.py
|
| 17 |
+
pypcd/tests/test_pypcd.py
|
Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/pypcd.egg-info/dependency_links.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/pypcd.egg-info/requires.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
numpy
|
| 2 |
+
python-lzf
|
Annotated_Lidar/ntu_day_01/pypcd-master/pypcd-master/pypcd.egg-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pypcd
|
Annotated_Lidar/ntu_day_10/convert_pcd_2_npy.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import numpy as np
|
| 3 |
+
import open3d as o3d
|
| 4 |
+
from pypcd import pypcd
|
| 5 |
+
|
| 6 |
+
def convert_pcd_to_npy(input_folder, output_folder):
|
| 7 |
+
"""
|
| 8 |
+
Convert all .pcd files in the input folder to .npy format and save them in the output folder.
|
| 9 |
+
|
| 10 |
+
Args:
|
| 11 |
+
input_folder (str): Path to the folder containing .pcd files.
|
| 12 |
+
output_folder (str): Path to the folder to save .npy files.
|
| 13 |
+
"""
|
| 14 |
+
# Ensure the output folder exists
|
| 15 |
+
os.makedirs(output_folder, exist_ok=True)
|
| 16 |
+
|
| 17 |
+
# Iterate through all files in the input folder
|
| 18 |
+
for file_name in os.listdir(input_folder):
|
| 19 |
+
if file_name.endswith('.pcd'):
|
| 20 |
+
input_path = os.path.join(input_folder, file_name)
|
| 21 |
+
output_path = os.path.join(output_folder, file_name.replace('.pcd', '.npy'))
|
| 22 |
+
# Read the .pcd file using pypcd with the file path
|
| 23 |
+
pc_data = pypcd.PointCloud.from_path(input_path)
|
| 24 |
+
|
| 25 |
+
# Extract all fields from the .pcd file
|
| 26 |
+
data = {}
|
| 27 |
+
for field in pc_data.fields:
|
| 28 |
+
data[field] = pc_data.pc_data[field]
|
| 29 |
+
|
| 30 |
+
# Convert to a structured numpy array
|
| 31 |
+
structured_array = np.core.records.fromarrays(
|
| 32 |
+
[data[field] for field in pc_data.fields],
|
| 33 |
+
names=pc_data.fields
|
| 34 |
+
)
|
| 35 |
+
array_4d = np.vstack((structured_array['x'], structured_array['y'], structured_array['z'], structured_array['label'])).T
|
| 36 |
+
# Save as .npy file
|
| 37 |
+
np.save(output_path, array_4d)
|
| 38 |
+
print(f"Converted {file_name} to {output_path}")
|
| 39 |
+
|
| 40 |
+
if __name__ == "__main__":
|
| 41 |
+
input_folder = "inL_labelled"
|
| 42 |
+
output_folder = "npy_output"
|
| 43 |
+
|
| 44 |
+
convert_pcd_to_npy(input_folder, output_folder)
|
Annotated_Lidar/ntu_day_10/pose_inW.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0033.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:69d1aac16b12d194e01906032047af4ff8a54f90cfb1c221ae0eb1b34ae8f65b
|
| 3 |
+
size 784
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0061.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:67820d899db4b52584ff5ee0f689e349796af7da618bd5cd378fa61873eab1b0
|
| 3 |
+
size 672
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0070.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5b846f6848a29ab1e9a311684854cc4a717ddcc55e0d5ace4cfbbbd73d00529b
|
| 3 |
+
size 928
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0087.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bf7633c08155bac6d495d3eeff691ffada693b5b35ca81333f146efa877fd833
|
| 3 |
+
size 1120
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0097.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d4d8212bbda4f52f52317abab7c40f959b4744e02faaaf4916b00b0c7f3db2a0
|
| 3 |
+
size 816
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0098.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2b415f07ee4ed38f58b47c57ea4974d79702d140fca5b5657589bea3992f9f4f
|
| 3 |
+
size 832
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0100.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ae3205aa502248cf4d70f22466433846f251b04d2dd129f014a9349f6663a0c9
|
| 3 |
+
size 672
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0165.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:db87b1eee719ab09d12f6e634b37354d050ba319b0005579e094e354516732f7
|
| 3 |
+
size 880
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0246.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:42d8212bdde806edafcd74d3bf453a0d7240be5fef4c243d921cd30e4506b6d9
|
| 3 |
+
size 1216
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0267.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d24d18dd7e472e6db2763916a76f2b38fd56623c354e215d293afef7f9c5d17b
|
| 3 |
+
size 880
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0302.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1159cbced1397b17ae1fa7de19b78a0475cad61c149fab97a56688f99329d741
|
| 3 |
+
size 704
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0307.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b5fb777547372e209020e791a5db2a4e364e383013b6d86485512acad6d4de72
|
| 3 |
+
size 672
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0354.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:67958652f62fae2eede19657033005f0acce7e3eb8153499831e110996db47cc
|
| 3 |
+
size 528
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0356.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0adee86c9bb8ad88bcc9fce528d90a2f35b2d27d7cb0032d6856f4667e0cd62a
|
| 3 |
+
size 528
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0366.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b2c2e9031d42fe3b241e8fbe0aa16de63e8d2c72cf5ec8ab45d82c199e27d8cc
|
| 3 |
+
size 672
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0367.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d72e69305118e52ee98b1227c2f89f633df9b39451f82ead3e387adff16dfb11
|
| 3 |
+
size 592
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0372.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fea3ad0c48c6df4c90677adb4d2739ceff4a831b393500f9c80c1aeba7b76da0
|
| 3 |
+
size 608
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0403.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5b059d40dc4eef7e80f165c744a132f1b715bf608994f3a349e212a2a32396ab
|
| 3 |
+
size 672
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0447.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7421f2c15e816f63d0e3f4ba0874d48e968a52acbd22cf5e8d9cd291b8d1d56a
|
| 3 |
+
size 544
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0469.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9dc286c3407b85622141367fd393cd2119a492a091bb373dea785baa34188157
|
| 3 |
+
size 624
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0475.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:99a62d6b2aa76bdc2f971ad33b8d79cca08e9327f4f10a46b70fa61c472430a7
|
| 3 |
+
size 576
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0489.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3b854120e0ffb9625abbacf3961c4620a3cbbfc97d8fb25645ce41a72844a7b8
|
| 3 |
+
size 608
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0514.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:30f79679b305f6f9a974c2c104c1b24d746908117fde73a17fa2ed1e96305a44
|
| 3 |
+
size 704
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0529.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:269b2a3e164d35b8950ec08fe8fff70097d44bbeebd43619140df43a5005fa5a
|
| 3 |
+
size 640
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0580.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ee08d4e946f23efdc6dbd196a48eb019e7c636244e28ed944b4064c5b760e620
|
| 3 |
+
size 736
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0639.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b7d068e5630a6f45aa2c4f6827927ce9a3939ac9fefbcd8674236654cca7939b
|
| 3 |
+
size 480
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0646.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:87a992921edc56f2ef7457eed491244c84ff169048ebb25a0c21998064044a7b
|
| 3 |
+
size 496
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0656.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4f8913604180700d787b22c839076dbba945ce3a95d2994140f16897144cf0ae
|
| 3 |
+
size 640
|
mcd_cluster_keypoints_ntu_day01_mcd_raw72/keypoints_cloud_0659.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:06e8df8d37d4151fc438a5f91836026f46de7aed8b57039a717af8975b9108f8
|
| 3 |
+
size 528
|