Skip to content

Commit e5d3c6d

Browse files
committed
Formatting javadoc.
1 parent eb17144 commit e5d3c6d

File tree

2 files changed

+116
-38
lines changed

2 files changed

+116
-38
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/PythonAbstractObject.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,16 +1349,16 @@ static Object doExecute(Object receiver, Object[] arguments,
13491349
// only kwargs are in arguments
13501350
newArgs = new Object[0];
13511351
}
1352-
} else if (lastHasMembers
1353-
&& isStarargsProfile2.profile(inliningTarget, iLibPosArgs.isMemberReadable(last, POSARGS_MEMBER) && iLibPosArgs.readMember(last, POSARGS_MEMBER) == Boolean.TRUE)) {
1352+
} else if (lastHasMembers &&
1353+
isStarargsProfile2.profile(inliningTarget, iLibPosArgs.isMemberReadable(last, POSARGS_MEMBER) && iLibPosArgs.readMember(last, POSARGS_MEMBER) == Boolean.TRUE)) {
13541354
posArgs = last;
13551355
}
13561356

13571357
if (isStarargsDefinedProfile.profile(inliningTarget, posArgs != null)) {
13581358
long length = iLibPosArgs.getArraySize(posArgs);
13591359
Object iterator = iLibPosArgs.getIterator(posArgs);
13601360
loopProfile.profileCounted(inliningTarget, length);
1361-
Object[] starArgs = new Object[(int)length];
1361+
Object[] starArgs = new Object[(int) length];
13621362
for (int i = 0; loopProfile.inject(inliningTarget, i < length); i++) {
13631363
starArgs[i] = iLibIterator.getIteratorNextElement(iterator);
13641364
}

graalpython/org.graalvm.python.embedding/src/org/graalvm/python/embedding/KeywordArguments.java

Lines changed: 113 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -54,53 +54,73 @@
5454
* Represents a set of keyword arguments, typically used for interfacing with Python functions that
5555
* accept {@code **kwargs}.
5656
*
57-
* <h3>When to Use</h3>
58-
* {@link KeywordArguments} must be used whenever a Python function accepts
57+
* <h3>When to Use</h3> {@link KeywordArguments} must be used whenever a Python function accepts
5958
* named arguments (both required and optional). This ensures proper mapping of Java arguments to
6059
* Python function parameters, especially when working with Python methods that utilize
6160
* {@code **kwargs}.
6261
*
63-
* <p><b>Important:</b> An instance of {@link KeywordArguments} must always be the last argument when
62+
* <p>
63+
* <b>Important:</b> An instance of {@link KeywordArguments} must always be the last argument when
6464
* invoking a Python function. It may be preceded by an instance of {@link PositionalArguments}, but
6565
* {@link KeywordArguments} must always be the final argument. This ensures proper alignment with
66-
* Python's argument structure.</p>
66+
* Python's argument structure.
67+
* </p>
6768
*
68-
* <p>The {@link KeywordArguments} class provides factory methods to create instances from a
69-
* {@link Map} or by directly specifying key-value pairs.</p>
69+
* <p>
70+
* The {@link KeywordArguments} class provides factory methods to create instances from a
71+
* {@link Map} or by directly specifying key-value pairs.
72+
* </p>
7073
*
7174
* <h3>Usage</h3>
7275
*
73-
* <p>Consider the following Python function:</p>
76+
* <p>
77+
* Consider the following Python function:
78+
* </p>
79+
*
7480
* <pre>{@code
7581
* def example_function(*, named1, named2, named3=None, named4=42):
7682
* ...
7783
* }</pre>
7884
*
79-
* <p>In this function, <code>named1</code> and <code>named2</code> are required keyword arguments,
80-
* while <code>named3</code> and <code>named4</code> are optional because they have default values.</p>
85+
* <p>
86+
* In this function, <code>named1</code> and <code>named2</code> are required keyword arguments,
87+
* while <code>named3</code> and <code>named4</code> are optional because they have default values.
88+
* </p>
8189
*
82-
* <p>From Java, this function can be invoked as:</p>
90+
* <p>
91+
* From Java, this function can be invoked as:
92+
* </p>
93+
*
8394
* <pre>{@code
8495
* value.invokeMember("example_function", kwArgs);
8596
* }</pre>
8697
*
87-
* <p>The variable <code>kwArgs</code> can be created in several ways:</p>
98+
* <p>
99+
* The variable <code>kwArgs</code> can be created in several ways:
100+
* </p>
88101
*
89-
* <p><b>Using a map:</b></p>
102+
* <p>
103+
* <b>Using a map:</b>
104+
* </p>
105+
*
90106
* <pre>{@code
91107
* KeywordArguments kwargs = KeywordArguments.from(
92-
* Map.of("named1", 10, "named2", "value", "named4", 100)
93-
* );
108+
* Map.of("named1", 10, "named2", "value", "named4", 100));
94109
* }</pre>
95110
*
96-
* <p><b>Using key-value pairs:</b></p>
111+
* <p>
112+
* <b>Using key-value pairs:</b>
113+
* </p>
114+
*
97115
* <pre>{@code
98116
* KeywordArguments kwargs = KeywordArguments.of(
99-
* "named1", 10, "named2", "value", "named4", 100
100-
* );
117+
* "named1", 10, "named2", "value", "named4", 100);
101118
* }</pre>
102119
*
103-
* <p><b>Using a builder:</b></p>
120+
* <p>
121+
* <b>Using a builder:</b>
122+
* </p>
123+
*
104124
* <pre>{@code
105125
* public static final class ExampleFunctionKwArgsBuilder {
106126
* private final Map<String, Object> values = new HashMap<>();
@@ -135,12 +155,15 @@
135155
* }
136156
* }</pre>
137157
*
138-
* <p><b>Using the builder to create the arguments:</b></p>
158+
* <p>
159+
* <b>Using the builder to create the arguments:</b>
160+
* </p>
161+
*
139162
* <pre>{@code
140163
* KeywordArguments kwargs = new ExampleFunctionKwArgsBuilder("value1", "value2") // Required keys
141-
* .named4(100) // Optional key
142-
* .add("dynamicKey", 42) // Dynamic key
143-
* .build();
164+
* .named4(100) // Optional key
165+
* .add("dynamicKey", 42) // Dynamic key
166+
* .build();
144167
* }</pre>
145168
*
146169
* @see PositionalArguments
@@ -332,7 +355,8 @@ public static KeywordArguments of(String name1, Object value1, String name2, Obj
332355
* @param value2 the value of the second argument
333356
* @param name3 the name of the third argument
334357
* @param value3 the value of the third argument
335-
* ... (similar for other parameters) ...
358+
* @param name4 the name of the fourth argument
359+
* @param value4 the value of the fourth argument
336360
* @return a new {@link KeywordArguments} instance containing the specified arguments
337361
* @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object)
338362
*/
@@ -349,9 +373,13 @@ public static KeywordArguments of(String name1, Object value1, String name2, Obj
349373
* @param value2 the value of the second argument
350374
* @param name3 the name of the third argument
351375
* @param value3 the value of the third argument
352-
* ... (similar for other parameters) ...
376+
* @param name4 the name of the fourth argument
377+
* @param value4 the value of the fourth argument
378+
* @param name5 the name of the fifth argument
379+
* @param value5 the value of the fifth argument
353380
* @return a new {@link KeywordArguments} instance containing the specified arguments
354-
* @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
381+
* @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object,
382+
* Object)
355383
*/
356384
public static KeywordArguments of(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4,
357385
String name5, Object value5) {
@@ -368,9 +396,15 @@ public static KeywordArguments of(String name1, Object value1, String name2, Obj
368396
* @param value2 the value of the second argument
369397
* @param name3 the name of the third argument
370398
* @param value3 the value of the third argument
371-
* ... (similar for other parameters) ...
399+
* @param name4 the name of the fourth argument
400+
* @param value4 the value of the fourth argument
401+
* @param name5 the name of the fifth argument
402+
* @param value5 the value of the fifth argument
403+
* @param name6 the name of the sixth argument
404+
* @param value6 the value of the sixth argument
372405
* @return a new {@link KeywordArguments} instance containing the specified arguments
373-
* @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
406+
* @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object,
407+
* Object, Object, Object)
374408
*/
375409
public static KeywordArguments of(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4,
376410
String name5, Object value5, String name6, Object value6) {
@@ -387,9 +421,17 @@ public static KeywordArguments of(String name1, Object value1, String name2, Obj
387421
* @param value2 the value of the second argument
388422
* @param name3 the name of the third argument
389423
* @param value3 the value of the third argument
390-
* ... (similar for other parameters) ...
424+
* @param name4 the name of the fourth argument
425+
* @param value4 the value of the fourth argument
426+
* @param name5 the name of the fifth argument
427+
* @param value5 the value of the fifth argument
428+
* @param name6 the name of the sixth argument
429+
* @param value6 the value of the sixth argument
430+
* @param name7 the name of the seventh argument
431+
* @param value7 the value of the seventh argument
391432
* @return a new {@link KeywordArguments} instance containing the specified arguments
392-
* @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
433+
* @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object,
434+
* Object, Object, Object, Object, Object)
393435
*/
394436
public static KeywordArguments of(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4,
395437
String name5, Object value5, String name6, Object value6, String name7, Object value7) {
@@ -406,9 +448,19 @@ public static KeywordArguments of(String name1, Object value1, String name2, Obj
406448
* @param value2 the value of the second argument
407449
* @param name3 the name of the third argument
408450
* @param value3 the value of the third argument
409-
* ... (similar for other parameters) ...
451+
* @param name4 the name of the fourth argument
452+
* @param value4 the value of the fourth argument
453+
* @param name5 the name of the fifth argument
454+
* @param value5 the value of the fifth argument
455+
* @param name6 the name of the sixth argument
456+
* @param value6 the value of the sixth argument
457+
* @param name7 the name of the seventh argument
458+
* @param value7 the value of the seventh argument
459+
* @param name8 the name of the eighth argument
460+
* @param value8 the value of the eighth argument
410461
* @return a new {@link KeywordArguments} instance containing the specified arguments
411-
* @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
462+
* @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object,
463+
* Object, Object, Object, Object, Object, Object, Object)
412464
*/
413465
public static KeywordArguments of(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4,
414466
String name5, Object value5, String name6, Object value6, String name7, Object value7, String name8, Object value8) {
@@ -425,9 +477,21 @@ public static KeywordArguments of(String name1, Object value1, String name2, Obj
425477
* @param value2 the value of the second argument
426478
* @param name3 the name of the third argument
427479
* @param value3 the value of the third argument
428-
* ... (similar for other parameters) ...
480+
* @param name4 the name of the fourth argument
481+
* @param value4 the value of the fourth argument
482+
* @param name5 the name of the fifth argument
483+
* @param value5 the value of the fifth argument
484+
* @param name6 the name of the sixth argument
485+
* @param value6 the value of the sixth argument
486+
* @param name7 the name of the seventh argument
487+
* @param value7 the value of the seventh argument
488+
* @param name8 the name of the eighth argument
489+
* @param value8 the value of the eighth argument
490+
* @param name9 the name of the ninth argument
491+
* @param value9 the value of the ninth argument
429492
* @return a new {@link KeywordArguments} instance containing the specified arguments
430-
* @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
493+
* @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object,
494+
* Object, Object, Object, Object, Object, Object, Object, Object, Object)
431495
*/
432496
public static KeywordArguments of(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4,
433497
String name5, Object value5, String name6, Object value6, String name7, Object value7, String name8, Object value8,
@@ -445,9 +509,23 @@ public static KeywordArguments of(String name1, Object value1, String name2, Obj
445509
* @param value2 the value of the second argument
446510
* @param name3 the name of the third argument
447511
* @param value3 the value of the third argument
448-
* ... (similar for other parameters) ...
512+
* @param name4 the name of the fourth argument
513+
* @param value4 the value of the fourth argument
514+
* @param name5 the name of the fifth argument
515+
* @param value5 the value of the fifth argument
516+
* @param name6 the name of the sixth argument
517+
* @param value6 the value of the sixth argument
518+
* @param name7 the name of the seventh argument
519+
* @param value7 the value of the seventh argument
520+
* @param name8 the name of the eighth argument
521+
* @param value8 the value of the eighth argument
522+
* @param name9 the name of the ninth argument
523+
* @param value9 the value of the ninth argument
524+
* @param name10 the name of the tenth argument
525+
* @param value10 the value of the tenth argument
449526
* @return a new {@link KeywordArguments} instance containing the specified arguments
450-
* @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
527+
* @see java.util.Map#of(Object, Object, Object, Object, Object, Object, Object, Object, Object,
528+
* Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
451529
*/
452530
public static KeywordArguments of(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4,
453531
String name5, Object value5, String name6, Object value6, String name7, Object value7, String name8, Object value8,

0 commit comments

Comments
 (0)