From 92621f2f2dd5f253f3ed5fe7bfbf13a86eb42631 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Sat, 28 Mar 2015 10:41:51 -0700 Subject: [PATCH] fix for issue 567, added reserved words, rebuilt client --- .../swagger/codegen/languages/PythonClientCodegen.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/PythonClientCodegen.java b/modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/PythonClientCodegen.java index 962f5ac08487..bc47b4041daf 100755 --- a/modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/PythonClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/PythonClientCodegen.java @@ -4,6 +4,7 @@ import com.wordnik.swagger.codegen.*; import com.wordnik.swagger.models.properties.*; import java.io.File; +import java.util.*; public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig { String module = "client"; @@ -50,7 +51,14 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig typeMapping.put("string", "str"); typeMapping.put("date", "datetime"); - + // from https://docs.python.org/release/2.5.4/ref/keywords.html + reservedWords = new HashSet ( + Arrays.asList( + "and", "del", "from", "not", "while", "as", "elif", "global", "or", "with", + "assert", "else", "if", "pass", "yield", "break", "except", "import", + "print", "class", "exec", "in", "raise", "continue", "finally", "is", + "return", "def", "for", "lambda", "try")); + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("swagger.mustache", module, "swagger.py")); supportingFiles.add(new SupportingFile("__init__.mustache", module, "__init__.py"));