Merge pull request #6112 from chubinou/flask_reserved_words

[Flask] self and None are reserved words (#6111)
This commit is contained in:
wing328 2017-07-19 23:00:56 +08:00 committed by GitHub
commit 2dddfd6f16
2 changed files with 4 additions and 12 deletions

View File

@ -69,7 +69,7 @@ public class FlaskConnexionCodegen extends DefaultCodegen implements CodegenConf
typeMapping.put("file", "file"); typeMapping.put("file", "file");
typeMapping.put("UUID", "str"); typeMapping.put("UUID", "str");
// from https://docs.python.org/release/2.5.4/ref/keywords.html // from https://docs.python.org/3/reference/lexical_analysis.html#keywords
setReservedWordsLowerCase( setReservedWordsLowerCase(
Arrays.asList( Arrays.asList(
// @property // @property
@ -78,7 +78,7 @@ public class FlaskConnexionCodegen extends DefaultCodegen implements CodegenConf
"and", "del", "from", "not", "while", "as", "elif", "global", "or", "with", "and", "del", "from", "not", "while", "as", "elif", "global", "or", "with",
"assert", "else", "if", "pass", "yield", "break", "except", "import", "assert", "else", "if", "pass", "yield", "break", "except", "import",
"print", "class", "exec", "in", "raise", "continue", "finally", "is", "print", "class", "exec", "in", "raise", "continue", "finally", "is",
"return", "def", "for", "lambda", "try", "self", "None")); "return", "def", "for", "lambda", "try", "self", "None", "True", "False", "nonlocal"));
// set the output folder here // set the output folder here
outputFolder = "generated-code/connexion"; outputFolder = "generated-code/connexion";
@ -93,14 +93,6 @@ public class FlaskConnexionCodegen extends DefaultCodegen implements CodegenConf
*/ */
embeddedTemplateDir = templateDir = "flaskConnexion"; embeddedTemplateDir = templateDir = "flaskConnexion";
// from https://docs.python.org/release/2.5.4/ref/keywords.html
setReservedWordsLowerCase(
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"));
/* /*
* Additional Properties. These values can be passed to the templates and * Additional Properties. These values can be passed to the templates and
* are available in models, apis, and supporting files * are available in models, apis, and supporting files

View File

@ -90,7 +90,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
// map uuid to string for the time being // map uuid to string for the time being
typeMapping.put("UUID", "str"); typeMapping.put("UUID", "str");
// from https://docs.python.org/release/2.5.4/ref/keywords.html // from https://docs.python.org/3/reference/lexical_analysis.html#keywords
setReservedWordsLowerCase( setReservedWordsLowerCase(
Arrays.asList( Arrays.asList(
// local variable name used in API methods (endpoints) // local variable name used in API methods (endpoints)
@ -102,7 +102,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
"and", "del", "from", "not", "while", "as", "elif", "global", "or", "with", "and", "del", "from", "not", "while", "as", "elif", "global", "or", "with",
"assert", "else", "if", "pass", "yield", "break", "except", "import", "assert", "else", "if", "pass", "yield", "break", "except", "import",
"print", "class", "exec", "in", "raise", "continue", "finally", "is", "print", "class", "exec", "in", "raise", "continue", "finally", "is",
"return", "def", "for", "lambda", "try", "self", "None")); "return", "def", "for", "lambda", "try", "self", "nonlocal", "None", "True", "False"));
regexModifiers = new HashMap<Character, String>(); regexModifiers = new HashMap<Character, String>();
regexModifiers.put('i', "IGNORECASE"); regexModifiers.put('i', "IGNORECASE");