11import { createSdkContext } from "@azure-tools/typespec-client-generator-core" ;
22import type { EmitContext } from "@typespec/compiler" ;
3- import {
4- emitFile ,
5- joinPaths ,
6- listServices ,
7- NoTarget ,
8- } from "@typespec/compiler" ;
3+ import { emitFile , joinPaths , listServices , NoTarget } from "@typespec/compiler" ;
94import pkgJson from "../../package.json" with { type : "json" } ;
105import { emitCodeModel } from "./code-model.js" ;
116import {
@@ -97,10 +92,7 @@ function walkThroughNodes(yamlMap: Record<string, any>): Record<string, any> {
9792 }
9893 } else if ( Array . isArray ( current [ key ] ) ) {
9994 stack . push ( current [ key ] ) ;
100- } else if (
101- current [ key ] !== undefined &&
102- typeof current [ key ] === "object"
103- ) {
95+ } else if ( current [ key ] !== undefined && typeof current [ key ] === "object" ) {
10496 stack . push ( current [ key ] ) ;
10597 }
10698 }
@@ -172,9 +164,7 @@ export async function $onEmit(context: EmitContext<PythonEmitterOptions>) {
172164 "========================================= error stack start ================================================" ;
173165 const errStackEnd =
174166 "========================================= error stack end ================================================" ;
175- const errStack = error . stack
176- ? `\n${ errStackStart } \n${ error . stack } \n${ errStackEnd } `
177- : "" ;
167+ const errStack = error . stack ? `\n${ errStackStart } \n${ error . stack } \n${ errStackEnd } ` : "" ;
178168 reportDiagnostic ( context . program , {
179169 code : "unknown-error" ,
180170 target : NoTarget ,
@@ -205,19 +195,17 @@ async function onEmitMain(context: EmitContext<PythonEmitterOptions>) {
205195 const resolvedOptions = sdkContext . emitContext . options ;
206196 const commandArgs : Record < string , string > = { } ;
207197 if ( resolvedOptions [ "packaging-files-config" ] ) {
208- const keyValuePairs = Object . entries (
209- resolvedOptions [ "packaging-files-config" ] ,
210- ) . map ( ( [ key , value ] ) => {
211- return ` ${ key } : ${ value } ` ;
212- } ) ;
198+ const keyValuePairs = Object . entries ( resolvedOptions [ "packaging-files-config" ] ) . map (
199+ ( [ key , value ] ) => {
200+ return ` ${ key } : ${ value } ` ;
201+ } ,
202+ ) ;
213203 commandArgs [ "packaging-files-config" ] = keyValuePairs . join ( "|" ) ;
214204 resolvedOptions [ "packaging-files-config" ] = undefined ;
215205 }
216206 if ( resolvedOptions [ "keep-pyproject-fields" ] ) {
217207 // Flatten the object of enabled fields into a comma-separated list for the generator.
218- const enabledFields = Object . entries (
219- resolvedOptions [ "keep-pyproject-fields" ] ,
220- )
208+ const enabledFields = Object . entries ( resolvedOptions [ "keep-pyproject-fields" ] )
221209 . filter ( ( [ , value ] ) => value === true )
222210 . map ( ( [ key ] ) => key ) ;
223211 commandArgs [ "keep-pyproject-fields" ] = enabledFields . join ( "," ) ;
@@ -229,11 +217,8 @@ async function onEmitMain(context: EmitContext<PythonEmitterOptions>) {
229217 commandArgs [ key ] = value ;
230218 }
231219 if ( resolvedOptions [ "generate-packaging-files" ] ) {
232- commandArgs [ "package-mode" ] = sdkContext . arm
233- ? "azure-mgmt"
234- : "azure-dataplane" ;
235- commandArgs [ "keep-setup-py" ] =
236- resolvedOptions [ "keep-setup-py" ] === true ? "true" : "false" ;
220+ commandArgs [ "package-mode" ] = sdkContext . arm ? "azure-mgmt" : "azure-dataplane" ;
221+ commandArgs [ "keep-setup-py" ] = resolvedOptions [ "keep-setup-py" ] === true ? "true" : "false" ;
237222 }
238223 if ( sdkContext . arm === true ) {
239224 commandArgs [ "azure-arm" ] = "true" ;
0 commit comments