text
stringlengths
0
828
:return: TaxClass
If the method is called asynchronously,
returns the request thread.
""""""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return cls._replace_tax_class_by_id_with_http_info(tax_class_id, tax_class, **kwargs)
else:
(data) = cls._replace_tax_class_by_id_with_http_info(tax_class_id, tax_class, **kwargs)
return data"
4845,"def update_tax_class_by_id(cls, tax_class_id, tax_class, **kwargs):
""""""Update TaxClass
Update attributes of TaxClass
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.update_tax_class_by_id(tax_class_id, tax_class, async=True)
>>> result = thread.get()
:param async bool
:param str tax_class_id: ID of taxClass to update. (required)
:param TaxClass tax_class: Attributes of taxClass to update. (required)
:return: TaxClass
If the method is called asynchronously,
returns the request thread.
""""""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return cls._update_tax_class_by_id_with_http_info(tax_class_id, tax_class, **kwargs)
else:
(data) = cls._update_tax_class_by_id_with_http_info(tax_class_id, tax_class, **kwargs)
return data"
4846,"def autodiscover_modules(packages, related_name_re='.+',
ignore_exceptions=False):
""""""Autodiscover function follows the pattern used by Celery.
:param packages: List of package names to auto discover modules in.
:type packages: list of str
:param related_name_re: Regular expression used to match modules names.
:type related_name_re: str
:param ignore_exceptions: Ignore exception when importing modules.
:type ignore_exceptions: bool
""""""
warnings.warn('autodiscover_modules has been deprecated. '
'Use Flask-Registry instead.', DeprecationWarning)
global _RACE_PROTECTION
if _RACE_PROTECTION:
return []
_RACE_PROTECTION = True
modules = []
try:
tmp = [find_related_modules(pkg, related_name_re, ignore_exceptions)
for pkg in packages]
for l in tmp:
for m in l:
if m is not None:
modules.append(m)
# Workaround for finally-statement
except:
_RACE_PROTECTION = False
raise
_RACE_PROTECTION = False
return modules"
4847,"def find_related_modules(package, related_name_re='.+',
ignore_exceptions=False):
""""""Find matching modules using a package and a module name pattern.""""""
warnings.warn('find_related_modules has been deprecated.',
DeprecationWarning)
package_elements = package.rsplit(""."", 1)
try:
if len(package_elements) == 2:
pkg = __import__(package_elements[0], globals(), locals(), [
package_elements[1]])
pkg = getattr(pkg, package_elements[1])
else:
pkg = __import__(package_elements[0], globals(), locals(), [])
pkg_path = pkg.__path__
except AttributeError:
return []
# Find all modules named according to related_name
p = re.compile(related_name_re)
modules = []
for name in find_modules(package, include_packages=True):
if p.match(name.split('.')[-1]):
try:
modules.append(import_string(name, silent=ignore_exceptions))
except Exception as e:
if not ignore_exceptions:
raise e
return modules"
4848,"def import_related_module(package, pkg_path, related_name,
ignore_exceptions=False):
""""""Import module from given path.""""""
try:
imp.find_module(related_name, pkg_path)