Skip to content

Commit

Permalink
Undo unintential indentation changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JordonPhillips committed Oct 17, 2024
1 parent 58d6577 commit ff1df13
Showing 1 changed file with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ async def _handle_attempt(
)
""", CodegenUtils.getHttpAuthParamsSymbol(context.settings()),
writer.consumer(this::initializeHttpAuthParameters));
writer.consumer(this::initializeHttpAuthParameters));
writer.popState();

writer.addDependency(SmithyPythonDependency.SMITHY_CORE);
Expand Down Expand Up @@ -649,48 +649,48 @@ private void generateOperation(PythonWriter writer, OperationShape operation) {

writer.openBlock("async def $L(self, input: $T, plugins: list[$T] | None = None) -> $T:", "",
operationSymbol.getName(), inputSymbol, pluginSymbol, outputSymbol, () -> {
writer.writeDocs(() -> {
var docs = operation.getTrait(DocumentationTrait.class)
.map(StringTrait::getValue)
.orElse(String.format("Invokes the %s operation.", operation.getId().getName()));
writer.writeDocs(() -> {
var docs = operation.getTrait(DocumentationTrait.class)
.map(StringTrait::getValue)
.orElse(String.format("Invokes the %s operation.", operation.getId().getName()));

var inputDocs = input.getTrait(DocumentationTrait.class)
.map(StringTrait::getValue)
.orElse("The operation's input.");
var inputDocs = input.getTrait(DocumentationTrait.class)
.map(StringTrait::getValue)
.orElse("The operation's input.");

writer.write("""
writer.write("""
$L
:param input: $L
:param plugins: A list of callables that modify the configuration dynamically.
Changes made by these plugins only apply for the duration of the operation
execution and will not affect any other operation invocations.""", docs, inputDocs);
});

var defaultPlugins = new LinkedHashSet<SymbolReference>();
for (PythonIntegration integration : context.integrations()) {
for (RuntimeClientPlugin runtimeClientPlugin : integration.getClientPlugins()) {
if (runtimeClientPlugin.matchesOperation(context.model(), service, operation)) {
runtimeClientPlugin.getPythonPlugin().ifPresent(defaultPlugins::add);
}
}
});

var defaultPlugins = new LinkedHashSet<SymbolReference>();
for (PythonIntegration integration : context.integrations()) {
for (RuntimeClientPlugin runtimeClientPlugin : integration.getClientPlugins()) {
if (runtimeClientPlugin.matchesOperation(context.model(), service, operation)) {
runtimeClientPlugin.getPythonPlugin().ifPresent(defaultPlugins::add);
}
writer.write("""
}
}
writer.write("""
operation_plugins: list[Plugin] = [
$C
]
if plugins:
operation_plugins.extend(plugins)
""", writer.consumer(w -> writeDefaultPlugins(w, defaultPlugins)));

if (context.protocolGenerator() == null) {
writer.write("raise NotImplementedError()");
} else {
var protocolGenerator = context.protocolGenerator();
var serSymbol = protocolGenerator.getSerializationFunction(context, operation);
var deserSymbol = protocolGenerator.getDeserializationFunction(context, operation);
writer.write("""
if (context.protocolGenerator() == null) {
writer.write("raise NotImplementedError()");
} else {
var protocolGenerator = context.protocolGenerator();
var serSymbol = protocolGenerator.getSerializationFunction(context, operation);
var deserSymbol = protocolGenerator.getDeserializationFunction(context, operation);
writer.write("""
return await self._execute_operation(
input=input,
plugins=operation_plugins,
Expand All @@ -700,8 +700,8 @@ private void generateOperation(PythonWriter writer, OperationShape operation) {
operation_name=$S,
)
""", serSymbol, deserSymbol, operation.getId().getName());
}
});
}
});
}

private void generateEventStreamOperation(PythonWriter writer, OperationShape operation) {
Expand Down

0 comments on commit ff1df13

Please sign in to comment.