text stringlengths 0 828 |
|---|
if kwargs.get('async'): |
return cls._replace_free_shipping_coupon_by_id_with_http_info(free_shipping_coupon_id, free_shipping_coupon, **kwargs) |
else: |
(data) = cls._replace_free_shipping_coupon_by_id_with_http_info(free_shipping_coupon_id, free_shipping_coupon, **kwargs) |
return data" |
4486,"def update_free_shipping_coupon_by_id(cls, free_shipping_coupon_id, free_shipping_coupon, **kwargs): |
""""""Update FreeShippingCoupon |
Update attributes of FreeShippingCoupon |
This method makes a synchronous HTTP request by default. To make an |
asynchronous HTTP request, please pass async=True |
>>> thread = api.update_free_shipping_coupon_by_id(free_shipping_coupon_id, free_shipping_coupon, async=True) |
>>> result = thread.get() |
:param async bool |
:param str free_shipping_coupon_id: ID of freeShippingCoupon to update. (required) |
:param FreeShippingCoupon free_shipping_coupon: Attributes of freeShippingCoupon to update. (required) |
:return: FreeShippingCoupon |
If the method is called asynchronously, |
returns the request thread. |
"""""" |
kwargs['_return_http_data_only'] = True |
if kwargs.get('async'): |
return cls._update_free_shipping_coupon_by_id_with_http_info(free_shipping_coupon_id, free_shipping_coupon, **kwargs) |
else: |
(data) = cls._update_free_shipping_coupon_by_id_with_http_info(free_shipping_coupon_id, free_shipping_coupon, **kwargs) |
return data" |
4487,"def fetch_config(filename): |
""""""Fetch the Configuration schema information |
Finds the schema file, loads the file and reads the JSON, then converts to a dictionary that is returned |
"""""" |
# This trick gets the directory of *this* file Configuration.py thus |
# allowing to find the schema files relative to this file. |
dir_name = get_source_dir() |
# Append json |
filename = os.path.join('json', filename) |
fileobj = open(os.path.join(dir_name, filename), 'r') |
my_dict = json.loads(fileobj.read()) |
return my_dict" |
4488,"def populate_args_level(schema, parser): |
""""""Use a schema to populate a command line argument parser"""""" |
for key, value in schema['properties'].iteritems(): |
if key == 'name': |
continue |
arg = '--%s' % key |
desc = value['description'] |
if 'type' in value: |
if value['type'] == 'string': |
if 'enum' in value: |
parser.add_argument(arg, help=desc, type=str, |
choices=value['enum']) |
else: |
parser.add_argument(arg, help=desc, type=str) |
elif value['type'] == 'number': |
parser.add_argument(arg, help=desc, type=float) |
elif value['type'] == 'integer': |
parser.add_argument(arg, help=desc, type=int) |
elif str(value['type']) == 'array': |
assert value['minItems'] == value['maxItems'] |
if value['items']['type'] != 'number': |
raise NotImplementedError(""Only float arrays work"") |
parser.add_argument(arg, help=desc, type=float, |
nargs=value['maxItems'], metavar='N') |
elif value['type'] == 'object': |
#group = parser.add_argument_group(key, value['description']) |
#populate_args_level(value, group) |
pass" |
4489,"def set_json(self, config_json): |
""""""Permanently set the JSON configuration |
Unable to call twice."""""" |
if self.configuration_dict is not None: |
raise RuntimeError(""Can only set configuration once"", self.configuration_dict) |
schema = fetch_config('ConfigurationSchema.json') |
validictory.validate(config_json, schema) |
config_json['name'] = self.name |
config_json['run_number'] = self.run |
config_json['src_dir'] = get_source_dir() |
config_json['data_dir'] = get_data_dir() |
config_json['log_dir'] = get_log_dir() |
self.configuration_dict = config_json" |
4490,"def bulk_send(self, topic, kmsgs, timeout=60): |
"""""" Send a batch of messages |
:param str topic: a kafka topic |
:param ksr.transport.Message kmsgs: Messages to serialize |
:param int timeout: Timeout in seconds |
:return: Execution result |
:rtype: kser.result.Result |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.