docstring-generator-ext 2.0.10.post1__tar.gz → 2.0.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/PKG-INFO +1 -1
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/docstring_generator_ext.egg-info/PKG-INFO +1 -1
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/pyproject.toml +1 -1
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/FunctionFormat.cpp +4 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/FunctionFormat.hpp +1 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/parser.cpp +37 -17
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/MANIFEST.in +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/README.md +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/docstring_generator_ext.egg-info/SOURCES.txt +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/docstring_generator_ext.egg-info/dependency_links.txt +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/docstring_generator_ext.egg-info/requires.txt +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/docstring_generator_ext.egg-info/top_level.txt +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/setup.cfg +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/setup.py +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/GoogleDocstring.cpp +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/GoogleDocstring.hpp +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/IDocstringFormat.cpp +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/IDocstringFormat.hpp +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/NumpyDocstring.cpp +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/NumpyDocstring.hpp +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/ReStructuredDocstring.cpp +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/ReStructuredDocstring.hpp +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/docComparator.cpp +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/docComparator.hpp +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/docstringFormat.cpp +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/docstringFormat.hpp +0 -0
- {docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/parser.hpp +0 -0
{docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/FunctionFormat.cpp
RENAMED
|
@@ -133,6 +133,10 @@ void FunctionParameter::update_rest_description(const std::string &descr) noexce
|
|
|
133
133
|
return docstring.start_line;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
if (body_start > 0) {
|
|
137
|
+
return static_cast<int>(body_start);
|
|
138
|
+
}
|
|
139
|
+
|
|
136
140
|
if (returns.line_no > 0) {
|
|
137
141
|
return static_cast<int>(returns.line_no + 1);
|
|
138
142
|
}
|
|
@@ -306,39 +306,51 @@ void get_docstring_arg_descr(FunctionInfo &functionInfo) noexcept {
|
|
|
306
306
|
}
|
|
307
307
|
|
|
308
308
|
auto start = functionInfo.docstring.docstring.find('$');
|
|
309
|
-
if (start
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
309
|
+
if (start != std::string::npos) {
|
|
310
|
+
// we need to check if this is a an expected placeholder
|
|
311
|
+
const auto end_placeholder = functionInfo.docstring.docstring.find(' ', start + 1);
|
|
312
|
+
const auto possible_placeholder_num = functionInfo.docstring.docstring.substr(start + 1, end_placeholder - start - 1);
|
|
313
|
+
|
|
314
|
+
if (possible_placeholder_num.empty() ||
|
|
315
|
+
!std::all_of(possible_placeholder_num.begin(), possible_placeholder_num.end(),
|
|
316
|
+
[](unsigned char c) { return std::isdigit(c); })) {
|
|
314
317
|
return;
|
|
315
318
|
}
|
|
316
319
|
|
|
320
|
+
int id = -1;
|
|
317
321
|
try {
|
|
318
|
-
|
|
319
|
-
} catch (std::
|
|
322
|
+
id = std::stoi(possible_placeholder_num);
|
|
323
|
+
} catch (const std::exception &) {
|
|
320
324
|
return;
|
|
321
325
|
}
|
|
322
326
|
|
|
323
|
-
|
|
324
|
-
|
|
327
|
+
if (id < 0)
|
|
328
|
+
return;
|
|
329
|
+
|
|
330
|
+
auto end = functionInfo.docstring.docstring.find('\n', end_placeholder + 1);
|
|
331
|
+
if (end == std::string::npos) {
|
|
325
332
|
return;
|
|
333
|
+
}
|
|
326
334
|
|
|
327
|
-
|
|
335
|
+
std::string description;
|
|
336
|
+
description.reserve(end - start);
|
|
328
337
|
|
|
329
|
-
|
|
338
|
+
try {
|
|
339
|
+
description = functionInfo.docstring.docstring.substr(end_placeholder + 1, end - end_placeholder - 1);
|
|
340
|
+
} catch (std::out_of_range &) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (static_cast<size_t>(id - 1) < functionInfo.args.size()) {
|
|
330
345
|
try {
|
|
331
|
-
functionInfo.args[id].description = description
|
|
346
|
+
functionInfo.args[id - 1].description = description;
|
|
332
347
|
} catch (std::out_of_range &) {
|
|
333
348
|
return;
|
|
334
349
|
}
|
|
335
350
|
|
|
336
|
-
auto reduce = functionInfo.offset > 0 ? 2 * functionInfo.offset + 2 : 4 + 2;
|
|
337
|
-
|
|
338
351
|
try {
|
|
339
352
|
functionInfo.docstring.docstring.erase(
|
|
340
|
-
start
|
|
341
|
-
end - start + reduce
|
|
353
|
+
start, description.size() + possible_placeholder_num.size() + 3
|
|
342
354
|
);
|
|
343
355
|
} catch (std::out_of_range &) {
|
|
344
356
|
// no further action needed
|
|
@@ -461,8 +473,15 @@ std::optional<FunctionInfo> analyze_function(
|
|
|
461
473
|
) noexcept {
|
|
462
474
|
std::vector<FunctionException> function_exceptions{};
|
|
463
475
|
|
|
476
|
+
uint64_t body_start = 0;
|
|
464
477
|
if (py::hasattr(obj, "body")) {
|
|
465
478
|
auto inner = py::getattr(obj, "body");
|
|
479
|
+
for (auto &elem: py::iter(inner)) {
|
|
480
|
+
if (py::hasattr(elem, "lineno")) {
|
|
481
|
+
body_start = py::cast<int>(py::getattr(elem, "lineno"));
|
|
482
|
+
break;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
466
485
|
get_exception(inner, ast_module, function_exceptions);
|
|
467
486
|
}
|
|
468
487
|
|
|
@@ -479,7 +498,7 @@ std::optional<FunctionInfo> analyze_function(
|
|
|
479
498
|
auto returns = py::getattr(obj, "returns");
|
|
480
499
|
|
|
481
500
|
std::string return_str{};
|
|
482
|
-
uint32_t return_end_line_no =
|
|
501
|
+
uint32_t return_end_line_no = body_start;
|
|
483
502
|
|
|
484
503
|
if (!returns.is_none()) {
|
|
485
504
|
return_str = parse_ast_obj(returns, ast_module);
|
|
@@ -498,6 +517,7 @@ std::optional<FunctionInfo> analyze_function(
|
|
|
498
517
|
FunctionInfo functionInfo{
|
|
499
518
|
.args = f_args,
|
|
500
519
|
.offset = offset,
|
|
520
|
+
.body_start = body_start,
|
|
501
521
|
.docstring = doc_str,
|
|
502
522
|
.returns = functionReturn,
|
|
503
523
|
.exceptions = {}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/GoogleDocstring.cpp
RENAMED
|
File without changes
|
{docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/GoogleDocstring.hpp
RENAMED
|
File without changes
|
{docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/IDocstringFormat.cpp
RENAMED
|
File without changes
|
{docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/IDocstringFormat.hpp
RENAMED
|
File without changes
|
{docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/NumpyDocstring.cpp
RENAMED
|
File without changes
|
{docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/NumpyDocstring.hpp
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/docComparator.cpp
RENAMED
|
File without changes
|
{docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/docComparator.hpp
RENAMED
|
File without changes
|
{docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/docstringFormat.cpp
RENAMED
|
File without changes
|
{docstring_generator_ext-2.0.10.post1 → docstring_generator_ext-2.0.11}/src/docstringFormat.hpp
RENAMED
|
File without changes
|
|
File without changes
|