Skip to content

[python] Add default Configuration #6554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,30 @@ from __future__ import absolute_import

import urllib3

import copy
import logging
import multiprocessing
import sys

from six import iteritems
from six import with_metaclass
from six.moves import http_client as httplib

class TypeWithDefault(type):
def __init__(cls, name, bases, dct):
super(TypeWithDefault, cls).__init__(name, bases, dct)
cls._default = None

class Configuration(object):
def __call__(cls):
if cls._default == None:
cls._default = type.__call__(cls)
return copy.copy(cls._default)

def set_default(cls, default):
cls._default = copy.copy(default)


class Configuration(with_metaclass(TypeWithDefault, object)):
"""
NOTE: This class is auto generated by the swagger code generator program.
Ref: https://github.com/swagger-api/swagger-codegen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class RESTClientObject(object):

addition_pool_args = {}
if configuration.assert_hostname is not None:
addition_pool_args['assert_hostname'] = config.assert_hostname
addition_pool_args['assert_hostname'] = configuration.assert_hostname

if maxsize is None:
if configuration.connection_pool_maxsize is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,30 @@

import urllib3

import copy
import logging
import multiprocessing
import sys

from six import iteritems
from six import with_metaclass
from six.moves import http_client as httplib

class TypeWithDefault(type):
def __init__(cls, name, bases, dct):
super(TypeWithDefault, cls).__init__(name, bases, dct)
cls._default = None

class Configuration(object):
def __call__(cls):
if cls._default == None:
cls._default = type.__call__(cls)
return copy.copy(cls._default)

def set_default(cls, default):
cls._default = copy.copy(default)


class Configuration(with_metaclass(TypeWithDefault, object)):
"""
NOTE: This class is auto generated by the swagger code generator program.
Ref: https://github.com/swagger-api/swagger-codegen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,30 @@

import urllib3

import copy
import logging
import multiprocessing
import sys

from six import iteritems
from six import with_metaclass
from six.moves import http_client as httplib

class TypeWithDefault(type):
def __init__(cls, name, bases, dct):
super(TypeWithDefault, cls).__init__(name, bases, dct)
cls._default = None

class Configuration(object):
def __call__(cls):
if cls._default == None:
cls._default = type.__call__(cls)
return copy.copy(cls._default)

def set_default(cls, default):
cls._default = copy.copy(default)


class Configuration(with_metaclass(TypeWithDefault, object)):
"""
NOTE: This class is auto generated by the swagger code generator program.
Ref: https://github.com/swagger-api/swagger-codegen
Expand Down
17 changes: 16 additions & 1 deletion samples/client/petstore/python/petstore_api/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,30 @@

import urllib3

import copy
import logging
import multiprocessing
import sys

from six import iteritems
from six import with_metaclass
from six.moves import http_client as httplib

class TypeWithDefault(type):
def __init__(cls, name, bases, dct):
super(TypeWithDefault, cls).__init__(name, bases, dct)
cls._default = None

class Configuration(object):
def __call__(cls):
if cls._default == None:
cls._default = type.__call__(cls)
return copy.copy(cls._default)

def set_default(cls, default):
cls._default = copy.copy(default)


class Configuration(with_metaclass(TypeWithDefault, object)):
"""
NOTE: This class is auto generated by the swagger code generator program.
Ref: https://github.com/swagger-api/swagger-codegen
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/python/petstore_api/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self, configuration, pools_size=4, maxsize=None):

addition_pool_args = {}
if configuration.assert_hostname is not None:
addition_pool_args['assert_hostname'] = config.assert_hostname
addition_pool_args['assert_hostname'] = configuration.assert_hostname

if maxsize is None:
if configuration.connection_pool_maxsize is not None:
Expand Down