Skip to content

Commit 92621f2

Browse files
committed
fix for issue 567, added reserved words, rebuilt client
1 parent 0686a91 commit 92621f2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/PythonClientCodegen.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.wordnik.swagger.models.properties.*;
55

66
import java.io.File;
7+
import java.util.*;
78

89
public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig {
910
String module = "client";
@@ -50,7 +51,14 @@ public PythonClientCodegen() {
5051
typeMapping.put("string", "str");
5152
typeMapping.put("date", "datetime");
5253

53-
54+
// from https://docs.python.org/release/2.5.4/ref/keywords.html
55+
reservedWords = new HashSet<String> (
56+
Arrays.asList(
57+
"and", "del", "from", "not", "while", "as", "elif", "global", "or", "with",
58+
"assert", "else", "if", "pass", "yield", "break", "except", "import",
59+
"print", "class", "exec", "in", "raise", "continue", "finally", "is",
60+
"return", "def", "for", "lambda", "try"));
61+
5462
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
5563
supportingFiles.add(new SupportingFile("swagger.mustache", module, "swagger.py"));
5664
supportingFiles.add(new SupportingFile("__init__.mustache", module, "__init__.py"));

0 commit comments

Comments
 (0)