text
stringlengths 0
828
|
---|
:param data: input dict |
:param separator: separator in compound keys |
:param replace: if true, remove the compound key. Otherwise the value will |
exist under the compound and expanded key |
:return: copy of input dict with expanded keys |
''' |
if not separator: |
return data |
return remap({'temp':data}, visit=lambda p, k, v: __expand_keys(k, v, separator, replace))['temp']" |
4976,"def __query(p, k, v, accepted_keys=None, required_values=None, path=None, exact=True): |
"""""" |
Query function given to visit method |
:param p: visited path in tuple form |
:param k: visited key |
:param v: visited value |
:param accepted_keys: list of keys where one must match k to satisfy query. |
:param required_values: list of values where one must match v to satisfy query |
:param path: exact path in tuple form that must match p to satisfy query |
:param exact: if True then key and value match uses contains function instead of == |
:return: True if all criteria are satisfied, otherwise False |
"""""" |
# if not k: |
# print '__query p k:', p, k |
# print p, k, accepted_keys, required_values, path, exact |
def as_values_iterable(v): |
if isinstance(v, dict): |
return v.values() |
elif isinstance(v, six.string_types): |
return [v] |
else: |
# assume is already some iterable type |
return v |
if path and path != p: |
return False |
if accepted_keys: |
if isinstance(accepted_keys, six.string_types): |
accepted_keys = [accepted_keys] |
if len([akey for akey in accepted_keys if akey == k or (not exact and akey in k)]) == 0: |
return False |
if required_values: |
if isinstance(required_values, six.string_types): |
required_values = [required_values] |
# Find all terms in the vfilter that have a match somewhere in the values of the v dict. If the |
# list is shorter than vfilter then some terms did not match and this v fails the test. |
if len(required_values) > len([term for term in required_values for nv in as_values_iterable(v) if term == nv or (not exact and term in nv)]): |
return False |
return True" |
4977,"def create_customer_group(cls, customer_group, **kwargs): |
""""""Create CustomerGroup |
Create a new CustomerGroup |
This method makes a synchronous HTTP request by default. To make an |
asynchronous HTTP request, please pass async=True |
>>> thread = api.create_customer_group(customer_group, async=True) |
>>> result = thread.get() |
:param async bool |
:param CustomerGroup customer_group: Attributes of customerGroup to create (required) |
:return: CustomerGroup |
If the method is called asynchronously, |
returns the request thread. |
"""""" |
kwargs['_return_http_data_only'] = True |
if kwargs.get('async'): |
return cls._create_customer_group_with_http_info(customer_group, **kwargs) |
else: |
(data) = cls._create_customer_group_with_http_info(customer_group, **kwargs) |
return data" |
4978,"def delete_customer_group_by_id(cls, customer_group_id, **kwargs): |
""""""Delete CustomerGroup |
Delete an instance of CustomerGroup 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_customer_group_by_id(customer_group_id, async=True) |
>>> result = thread.get() |
:param async bool |
:param str customer_group_id: ID of customerGroup to delete. (required) |
:return: None |
If the method is called asynchronously, |
returns the request thread. |
"""""" |
kwargs['_return_http_data_only'] = True |
if kwargs.get('async'): |
return cls._delete_customer_group_by_id_with_http_info(customer_group_id, **kwargs) |
else: |
(data) = cls._delete_customer_group_by_id_with_http_info(customer_group_id, **kwargs) |
return data" |
4979,"def get_customer_group_by_id(cls, customer_group_id, **kwargs): |
""""""Find CustomerGroup |
Return single instance of CustomerGroup by its ID. |
Subsets and Splits