Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb89a38

Browse files
committed
MAINT: remove unused API documentation generation
1 parent 78a499d commit bb89a38

6 files changed

Lines changed: 6 additions & 52 deletions

File tree

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ numpy/core/include/numpy/__ufunc_api.c
132132
numpy/core/include/numpy/__umath_generated.c
133133
numpy/core/include/numpy/_umath_doc_generated.h
134134
numpy/core/include/numpy/config.h
135-
numpy/core/include/numpy/multiarray_api.txt
136-
numpy/core/include/numpy/ufunc_api.txt
137135
numpy/core/lib/
138136
numpy/core/src/common/npy_sort.h
139137
numpy/core/src/common/templ_common.h

numpy/core/code_generators/genapi.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import os
1212
import re
1313
import sys
14-
import textwrap
1514
import importlib.util
1615

1716
from os.path import join
@@ -131,21 +130,6 @@ def __str__(self):
131130
doccomment = ''
132131
return '%s%s %s(%s)' % (doccomment, self.return_type, self.name, argstr)
133132

134-
def to_ReST(self):
135-
lines = ['::', '', ' ' + self.return_type]
136-
argstr = ',\000'.join([self._format_arg(*a) for a in self.args])
137-
name = ' %s' % (self.name,)
138-
s = textwrap.wrap('(%s)' % (argstr,), width=72,
139-
initial_indent=name,
140-
subsequent_indent=' ' * (len(name)+1),
141-
break_long_words=False)
142-
for l in s:
143-
lines.append(l.replace('\000', ' ').rstrip())
144-
lines.append('')
145-
if self.doc:
146-
lines.append(textwrap.dedent(self.doc))
147-
return '\n'.join(lines)
148-
149133
def api_hash(self):
150134
m = hashlib.md5()
151135
m.update(remove_whitespace(self.return_type))

numpy/core/code_generators/generate_numpy_api.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -141,19 +141,12 @@
141141
};
142142
"""
143143

144-
c_api_header = """
145-
===========
146-
NumPy C-API
147-
===========
148-
"""
149-
150144
def generate_api(output_dir, force=False):
151145
basename = 'multiarray_api'
152146

153147
h_file = os.path.join(output_dir, '__%s.h' % basename)
154148
c_file = os.path.join(output_dir, '__%s.c' % basename)
155-
d_file = os.path.join(output_dir, '%s.txt' % basename)
156-
targets = (h_file, c_file, d_file)
149+
targets = (h_file, c_file)
157150

158151
sources = numpy_api.multiarray_api
159152

@@ -167,7 +160,6 @@ def generate_api(output_dir, force=False):
167160
def do_generate_api(targets, sources):
168161
header_file = targets[0]
169162
c_file = targets[1]
170-
doc_file = targets[2]
171163

172164
global_vars = sources[0]
173165
scalar_bool_values = sources[1]
@@ -236,13 +228,6 @@ def do_generate_api(targets, sources):
236228
s = c_template % ',\n'.join(init_list)
237229
genapi.write_file(c_file, s)
238230

239-
# write to documentation
240-
s = c_api_header
241-
for func in numpyapi_list:
242-
s += func.to_ReST()
243-
s += '\n\n'
244-
genapi.write_file(doc_file, s)
245-
246231
return targets
247232

248233

numpy/core/code_generators/generate_ufunc_api.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ def generate_api(output_dir, force=False):
122122

123123
h_file = os.path.join(output_dir, '__%s.h' % basename)
124124
c_file = os.path.join(output_dir, '__%s.c' % basename)
125-
d_file = os.path.join(output_dir, '%s.txt' % basename)
126-
targets = (h_file, c_file, d_file)
125+
targets = (h_file, c_file)
127126

128127
sources = ['ufunc_api_order.txt']
129128

@@ -137,7 +136,6 @@ def generate_api(output_dir, force=False):
137136
def do_generate_api(targets, sources):
138137
header_file = targets[0]
139138
c_file = targets[1]
140-
doc_file = targets[2]
141139

142140
ufunc_api_index = genapi.merge_api_dicts((
143141
numpy_api.ufunc_funcs_api,
@@ -179,17 +177,6 @@ def do_generate_api(targets, sources):
179177
s = c_template % ',\n'.join(init_list)
180178
genapi.write_file(c_file, s)
181179

182-
# Write to documentation
183-
s = '''
184-
=================
185-
NumPy Ufunc C-API
186-
=================
187-
'''
188-
for func in ufunc_api_list:
189-
s += func.to_ReST()
190-
s += '\n\n'
191-
genapi.write_file(doc_file, s)
192-
193180
return targets
194181

195182

numpy/core/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,15 +537,15 @@ src_umath_doc_h = custom_target('_umath_doc_generated',
537537
)
538538

539539
src_numpy_api = custom_target('__multiarray_api',
540-
output : ['__multiarray_api.c', '__multiarray_api.h', 'multiarray_api.txt'],
540+
output : ['__multiarray_api.c', '__multiarray_api.h'],
541541
input : 'code_generators/generate_numpy_api.py',
542542
command: [py, '@INPUT@', '-o', '@OUTDIR@', '--ignore', src_umath_api_c],
543543
install: true, # NOTE: setup.py build installs all, but just need .h?
544544
install_dir: np_dir / 'core/include/numpy'
545545
)
546546

547547
src_ufunc_api = custom_target('__ufunc_api',
548-
output : ['__ufunc_api.c', '__ufunc_api.h', 'ufunc_api.txt'],
548+
output : ['__ufunc_api.c', '__ufunc_api.h'],
549549
input : 'code_generators/generate_ufunc_api.py',
550550
command: [py, '@INPUT@', '-o', '@OUTDIR@'],
551551
install: true, # NOTE: setup.py build installs all, but just need .h?

numpy/core/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,11 +630,11 @@ def generate_api(ext, build_dir):
630630
try:
631631
m = __import__(module_name)
632632
log.info('executing %s', script)
633-
h_file, c_file, doc_file = m.generate_api(os.path.join(build_dir, header_dir))
633+
h_file, c_file = m.generate_api(os.path.join(build_dir, header_dir))
634634
finally:
635635
del sys.path[0]
636636
config.add_data_files((header_dir, h_file),
637-
(header_dir, doc_file))
637+
)
638638
return (h_file,)
639639
return generate_api
640640

0 commit comments

Comments
 (0)