text
stringlengths
0
828
""service_id"": service_id,
""data"": data,
})
return
task = {""serviceId"": service_id, ""data"": data}
url = self.__app.starter_api_url + '/services/' + service_id + '/tasks'
last_e = None
for _idx in range(self.max_retries):
try:
resp = requests.post(
url=url,
data=json.dumps(task),
headers=self.headers,
timeout=15
)
try:
return json.loads(resp.text)
except Exception:
raise IOError(""Starter response read error: "" + resp.text)
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
# При ошибках подключения пытаемся еще раз
last_e = e
sleep(3)
raise last_e"
4616,"def parse_version_string(version_string):
""""""
Parse a version string into it's components.
>>> parse_version_string(""0.1"")
([0, 1], 'jenkins', None)
>>> parse_version_string(""0.3.2-jenkins-3447876"")
([0, 3, 2], 'jenkins', 3447876)
""""""
components = version_string.split('-') + [None, None]
version = list(map(int, components[0].split('.')))
build_tag = components[1] if components[1] else BUILD_TAG
build_number = int(components[2]) if components[2] else components[2]
return (version, build_tag, build_number)"
4617,"def format_version(version, build_number=None, build_tag=BUILD_TAG):
""""""
Format a version string for use in packaging.
>>> format_version([0,3,5])
'0.3.5'
>>> format_version([8, 8, 9], 23676)
'8.8.9-jenkins-23676'
>>> format_version([8, 8, 9], 23676, 'koekjes')
'8.8.9-koekjes-23676'
""""""
formatted_version = ""."".join(map(str, version))
if build_number is not None:
return ""{formatted_version}-{build_tag}-{build_number}"".format(**locals())
return formatted_version"
4618,"def based_on(self, based_on):
""""""Sets the based_on of this TaxRate.
:param based_on: The based_on of this TaxRate.
:type: str
""""""
allowed_values = [""shippingAddress"", ""billingAddress""]
if based_on is not None and based_on not in allowed_values:
raise ValueError(
""Invalid value for `based_on` ({0}), must be one of {1}""
.format(based_on, allowed_values)
)
self._based_on = based_on"
4619,"def create_tax_rate(cls, tax_rate, **kwargs):
""""""Create TaxRate
Create a new TaxRate
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.create_tax_rate(tax_rate, async=True)
>>> result = thread.get()
:param async bool
:param TaxRate tax_rate: Attributes of taxRate to create (required)
:return: TaxRate
If the method is called asynchronously,
returns the request thread.
""""""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return cls._create_tax_rate_with_http_info(tax_rate, **kwargs)
else:
(data) = cls._create_tax_rate_with_http_info(tax_rate, **kwargs)
return data"
4620,"def delete_tax_rate_by_id(cls, tax_rate_id, **kwargs):
""""""Delete TaxRate
Delete an instance of TaxRate by its ID.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.delete_tax_rate_by_id(tax_rate_id, async=True)