forked from loafle/openapi-generator-original
[python] modify python import classVarName to classFileName (#11180)
* fix python import classVarName to classFileName * add samples change
This commit is contained in:
@@ -6,7 +6,7 @@ from pprint import pprint
|
||||
{{#with apiInfo}}
|
||||
{{#each apis}}
|
||||
{{#if @first}}
|
||||
from {{packageName}}.{{apiPackage}} import {{classVarName}}
|
||||
from {{packageName}}.{{apiPackage}} import {{classFilename}}
|
||||
{{#each imports}}
|
||||
{{{import}}}
|
||||
{{/each}}
|
||||
@@ -18,7 +18,7 @@ from {{packageName}}.{{apiPackage}} import {{classVarName}}
|
||||
# Enter a context with an instance of the API client
|
||||
with {{{packageName}}}.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = {{classVarName}}.{{{classname}}}(api_client)
|
||||
api_instance = {{classFilename}}.{{{classname}}}(api_client)
|
||||
{{#each allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{#unless required}} (optional){{/unless}}{{#if defaultValue}} (default to {{{.}}}){{/if}}
|
||||
{{/each}}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
# raise a `RecursionError`.
|
||||
# In order to avoid this, import only the API that you directly need like:
|
||||
#
|
||||
# from {{packagename}}.{{apiPackage}}.{{classVarName}} import {{classname}}
|
||||
# from {{packagename}}.{{apiPackage}}.{{classFilename}} import {{classname}}
|
||||
#
|
||||
# or import this package, but before doing it, use:
|
||||
#
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
# Import APIs into API package:
|
||||
{{/if}}
|
||||
from {{packageName}}.{{apiPackage}}.{{classVarName}} import {{classname}}
|
||||
from {{packageName}}.{{apiPackage}}.{{classFilename}} import {{classname}}
|
||||
{{/each}}
|
||||
{{/with}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
```python
|
||||
import {{{packageName}}}
|
||||
from {{packageName}}.{{apiPackage}} import {{classVarName}}
|
||||
from {{packageName}}.{{apiPackage}} import {{classFilename}}
|
||||
{{#each imports}}
|
||||
{{{.}}}
|
||||
{{/each}}
|
||||
@@ -9,7 +9,7 @@ from pprint import pprint
|
||||
# Enter a context with an instance of the API client
|
||||
with {{{packageName}}}.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = {{classVarName}}.{{{classname}}}(api_client)
|
||||
api_instance = {{classFilename}}.{{{classname}}}(api_client)
|
||||
{{#if requiredParams}}
|
||||
|
||||
# example passing only required values which don't have defaults set
|
||||
|
||||
@@ -3,5 +3,5 @@ from __future__ import absolute_import
|
||||
# flake8: noqa
|
||||
|
||||
# import apis into api package
|
||||
{{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classVarName}} import {{classname}}
|
||||
{{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classFilename}} import {{classname}}
|
||||
{{/apis}}{{/apiInfo}}
|
||||
@@ -9,7 +9,7 @@ from __future__ import absolute_import
|
||||
__version__ = "{{packageVersion}}"
|
||||
|
||||
# import apis into sdk package
|
||||
{{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classVarName}} import {{classname}}
|
||||
{{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classFilename}} import {{classname}}
|
||||
{{/apis}}{{/apiInfo}}
|
||||
# import ApiClient
|
||||
from {{packageName}}.api_client import ApiClient
|
||||
|
||||
@@ -7,7 +7,7 @@ from __future__ import absolute_import
|
||||
import unittest
|
||||
|
||||
import {{packageName}}
|
||||
from {{apiPackage}}.{{classVarName}} import {{classname}} # noqa: E501
|
||||
from {{apiPackage}}.{{classFilename}} import {{classname}} # noqa: E501
|
||||
from {{packageName}}.rest import ApiException
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class {{#operations}}Test{{classname}}(unittest.TestCase):
|
||||
"""{{classname}} unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
self.api = {{apiPackage}}.{{classVarName}}.{{classname}}() # noqa: E501
|
||||
self.api = {{apiPackage}}.{{classFilename}}.{{classname}}() # noqa: E501
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
@@ -6,7 +6,7 @@ from pprint import pprint
|
||||
{{#apiInfo}}
|
||||
{{#apis}}
|
||||
{{#-first}}
|
||||
from {{apiPackage}} import {{classVarName}}
|
||||
from {{apiPackage}} import {{classFilename}}
|
||||
{{#imports}}
|
||||
{{{import}}}
|
||||
{{/imports}}
|
||||
@@ -18,7 +18,7 @@ from {{apiPackage}} import {{classVarName}}
|
||||
# Enter a context with an instance of the API client
|
||||
with {{{packageName}}}.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = {{classVarName}}.{{{classname}}}(api_client)
|
||||
api_instance = {{classFilename}}.{{{classname}}}(api_client)
|
||||
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||
{{/allParams}}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# raise a `RecursionError`.
|
||||
# In order to avoid this, import only the API that you directly need like:
|
||||
#
|
||||
# from {{packagename}}.api.{{classVarName}} import {{classname}}
|
||||
# from {{packagename}}.api.{{classFilename}} import {{classname}}
|
||||
#
|
||||
# or import this package, but before doing it, use:
|
||||
#
|
||||
@@ -18,6 +18,6 @@
|
||||
|
||||
# Import APIs into API package:
|
||||
{{/-first}}
|
||||
from {{apiPackage}}.{{classVarName}} import {{classname}}
|
||||
from {{apiPackage}}.{{classFilename}} import {{classname}}
|
||||
{{/apis}}
|
||||
{{/apiInfo}}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
```python
|
||||
import time
|
||||
import {{{packageName}}}
|
||||
from {{apiPackage}} import {{classVarName}}
|
||||
from {{apiPackage}} import {{classFilename}}
|
||||
{{#imports}}
|
||||
{{{.}}}
|
||||
{{/imports}}
|
||||
@@ -15,7 +15,7 @@ with {{{packageName}}}.ApiClient(configuration) as api_client:
|
||||
with {{{packageName}}}.ApiClient() as api_client:
|
||||
{{/hasAuthMethods}}
|
||||
# Create an instance of the API class
|
||||
api_instance = {{classVarName}}.{{{classname}}}(api_client)
|
||||
api_instance = {{classFilename}}.{{{classname}}}(api_client)
|
||||
{{#requiredParams}}
|
||||
{{^defaultValue}}
|
||||
{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import unittest
|
||||
|
||||
import {{packageName}}
|
||||
from {{apiPackage}}.{{classVarName}} import {{classname}} # noqa: E501
|
||||
from {{apiPackage}}.{{classFilename}} import {{classname}} # noqa: E501
|
||||
|
||||
|
||||
class {{#operations}}Test{{classname}}(unittest.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user