Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cannot apply both size and shape to points in a plot-by series #3402

Merged
merged 3 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,7 @@ private void generatePyFuncCallSequential(final StringBuilder sb,
.append(INDENT)
.append("j_figure = self.j_figure\n\n");

boolean needsMskCheck = false;

final Set<Set<String>> alreadyGenerated = new HashSet<>();

Expand All @@ -890,22 +891,36 @@ private void generatePyFuncCallSequential(final StringBuilder sb,
final List<String[]> argNames = pyArgNames(sigs, pyArgMap);

for (String[] argName : argNames) {
needsMskCheck = needsMskCheck || Arrays.stream(argName).anyMatch("multi_series_key"::equals);
final Pair<Key, String[]> e = new Pair<>(key, argName);
items.add(e);
}
}

if (needsMskCheck) {
sb.append(INDENT)
.append(INDENT)
.append("multi_series_key_used = False\n\n");
}

// sort from largest number of args to smallest number of args so that the most specific method is called
items.sort((a, b) -> b.second.length - a.second.length);

for (Pair<Key, String[]> item : items) {
final Key key = item.first;
final String[] an = item.second;

final boolean mskUsed = Arrays.stream(an).anyMatch("multi_series_key"::equals);

validateArgNames(an, alreadyGenerated, signatures, pyArgMap);
final String[] quoted_an = Arrays.stream(an).map(s -> "\"" + s + "\"").toArray(String[]::new);
final String[] quotedAn = Arrays.stream(an).map(s -> "\"" + s + "\"").toArray(String[]::new);

if (quoted_an.length == 0) {
// prevent removal of multi_series_key until after it's been fully used
final String[] filteredQuotedAn = Arrays.stream(quotedAn)
.filter(s -> !s.equals("\"multi_series_key\""))
.toArray(String[]::new);

if (quotedAn.length == 0) {
sb.append(INDENT)
.append(INDENT)
.append("if set()")
Expand All @@ -914,7 +929,7 @@ private void generatePyFuncCallSequential(final StringBuilder sb,
sb.append(INDENT)
.append(INDENT)
.append("if {")
.append(String.join(", ", quoted_an))
.append(String.join(", ", quotedAn))
.append("}.issubset(non_null_args):\n");
}
sb.append(INDENT)
Expand All @@ -929,12 +944,31 @@ private void generatePyFuncCallSequential(final StringBuilder sb,
.append(INDENT)
.append(INDENT)
.append("non_null_args = non_null_args.difference({")
.append(String.join(", ", quoted_an))
.append(String.join(", ", filteredQuotedAn))
.append("})\n")
.append(INDENT)
.append(INDENT)
.append(INDENT)
.append("f_called = True\n\n");
.append("f_called = True\n");

if (mskUsed) {
sb.append(INDENT)
.append(INDENT)
.append(INDENT)
.append("multi_series_key_used = True\n");
}

sb.append("\n");
}

if (needsMskCheck) {
sb.append(INDENT)
.append(INDENT)
.append("if multi_series_key_used:\n")
.append(INDENT)
.append(INDENT)
.append(INDENT)
.append("non_null_args = non_null_args.difference({\"multi_series_key\"})\n\n");
}

sb.append(INDENT)
Expand Down
Loading