body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1 value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
851a99f6e7add93cc450f88f7e828e9e170ec3a027f882392740b1f496e2f5a0 | def parse_dc_terms(dc_file):
'Retrieve a list of Dublin core terms from the RDF file.\n '
return _parse_terms_from_rdf(dc_file, 'dcterms') | Retrieve a list of Dublin core terms from the RDF file. | biosql_ontologies/genbank_to_ontology.py | parse_dc_terms | bgruening/bcbb | 339 | python | def parse_dc_terms(dc_file):
'\n '
return _parse_terms_from_rdf(dc_file, 'dcterms') | def parse_dc_terms(dc_file):
'\n '
return _parse_terms_from_rdf(dc_file, 'dcterms')<|docstring|>Retrieve a list of Dublin core terms from the RDF file.<|endoftext|> |
6d9950b825ec4629e713a9ff437df0249ee7a1e7fed123fa082ed258205b4911 | def parse_so_terms(so_file):
'Retrieve all available Sequence Ontology terms from the file.\n '
so_terms = []
with open(so_file) as in_handle:
for line in in_handle:
if (line.find('name:') == 0):
name = line[5:].strip()
so_terms.append(name)
return so_terms | Retrieve all available Sequence Ontology terms from the file. | biosql_ontologies/genbank_to_ontology.py | parse_so_terms | bgruening/bcbb | 339 | python | def parse_so_terms(so_file):
'\n '
so_terms = []
with open(so_file) as in_handle:
for line in in_handle:
if (line.find('name:') == 0):
name = line[5:].strip()
so_terms.append(name)
return so_terms | def parse_so_terms(so_file):
'\n '
so_terms = []
with open(so_file) as in_handle:
for line in in_handle:
if (line.find('name:') == 0):
name = line[5:].strip()
so_terms.append(name)
return so_terms<|docstring|>Retrieve all available Sequence Ontology terms from the file.<|endoftext|> |
aff25a6e08012e51dc5b399dc14208583a550ff9c833c3c2aa947d22e4d5afce | def parse_so_ft_map(so_ft_map_file):
'Parse out mappings between feature keys and SO.\n '
so_ft_map = {}
with open(so_ft_map_file) as in_handle:
in_handle.readline()
for line in in_handle:
parts = line.split()
if (parts[1] not in ['undefined']):
so_ft_map[parts[0]] = parts[1]
return so_ft_map | Parse out mappings between feature keys and SO. | biosql_ontologies/genbank_to_ontology.py | parse_so_ft_map | bgruening/bcbb | 339 | python | def parse_so_ft_map(so_ft_map_file):
'\n '
so_ft_map = {}
with open(so_ft_map_file) as in_handle:
in_handle.readline()
for line in in_handle:
parts = line.split()
if (parts[1] not in ['undefined']):
so_ft_map[parts[0]] = parts[1]
return so_ft_map | def parse_so_ft_map(so_ft_map_file):
'\n '
so_ft_map = {}
with open(so_ft_map_file) as in_handle:
in_handle.readline()
for line in in_handle:
parts = line.split()
if (parts[1] not in ['undefined']):
so_ft_map[parts[0]] = parts[1]
return so_ft_map<|docstring|>Parse out mappings between feature keys and SO.<|endoftext|> |
c5d3dbdbf35c084a03872d6885ce30ed7d7d0fc4ae88716fb5fda9fbc5800c06 | def parse_feature_table(ft_file):
'Parse all available features and qualifiers from the FT definition.\n\n This is ugly and parses it straight out of the HTML but this is much easier\n than trying to get it from the specs.\n '
feature_keys = []
qual_keys = []
with open(ft_file) as ft_handle:
in_feature_region = False
for line in ft_handle:
if in_feature_region:
if (line.strip() == ''):
in_feature_region = False
else:
(qual_key, feature_key) = line.strip().split()
qual_keys.append(qual_key)
feature_keys.append(feature_key)
elif (line.find('QUALIFIER FEATURE KEY') == 0):
in_feature_region = True
qual_keys = list(set(qual_keys))
qual_keys = [k.replace('/', '') for k in qual_keys]
feature_keys = list(set(feature_keys))
qual_keys.sort()
feature_keys.sort()
return (feature_keys, qual_keys) | Parse all available features and qualifiers from the FT definition.
This is ugly and parses it straight out of the HTML but this is much easier
than trying to get it from the specs. | biosql_ontologies/genbank_to_ontology.py | parse_feature_table | bgruening/bcbb | 339 | python | def parse_feature_table(ft_file):
'Parse all available features and qualifiers from the FT definition.\n\n This is ugly and parses it straight out of the HTML but this is much easier\n than trying to get it from the specs.\n '
feature_keys = []
qual_keys = []
with open(ft_file) as ft_handle:
in_feature_region = False
for line in ft_handle:
if in_feature_region:
if (line.strip() == ):
in_feature_region = False
else:
(qual_key, feature_key) = line.strip().split()
qual_keys.append(qual_key)
feature_keys.append(feature_key)
elif (line.find('QUALIFIER FEATURE KEY') == 0):
in_feature_region = True
qual_keys = list(set(qual_keys))
qual_keys = [k.replace('/', ) for k in qual_keys]
feature_keys = list(set(feature_keys))
qual_keys.sort()
feature_keys.sort()
return (feature_keys, qual_keys) | def parse_feature_table(ft_file):
'Parse all available features and qualifiers from the FT definition.\n\n This is ugly and parses it straight out of the HTML but this is much easier\n than trying to get it from the specs.\n '
feature_keys = []
qual_keys = []
with open(ft_file) as ft_handle:
in_feature_region = False
for line in ft_handle:
if in_feature_region:
if (line.strip() == ):
in_feature_region = False
else:
(qual_key, feature_key) = line.strip().split()
qual_keys.append(qual_key)
feature_keys.append(feature_key)
elif (line.find('QUALIFIER FEATURE KEY') == 0):
in_feature_region = True
qual_keys = list(set(qual_keys))
qual_keys = [k.replace('/', ) for k in qual_keys]
feature_keys = list(set(feature_keys))
qual_keys.sort()
feature_keys.sort()
return (feature_keys, qual_keys)<|docstring|>Parse all available features and qualifiers from the FT definition.
This is ugly and parses it straight out of the HTML but this is much easier
than trying to get it from the specs.<|endoftext|> |
a7de8f8bc575b7480a52a635ac074448b639932f91a28b93d3bb7104ec99dae3 | def add_map(self, key_type, origin, key_map):
'Add a mapping of keys to terms within this ontology.\n '
self._maps[key_type].append((origin, key_map)) | Add a mapping of keys to terms within this ontology. | biosql_ontologies/genbank_to_ontology.py | add_map | bgruening/bcbb | 339 | python | def add_map(self, key_type, origin, key_map):
'\n '
self._maps[key_type].append((origin, key_map)) | def add_map(self, key_type, origin, key_map):
'\n '
self._maps[key_type].append((origin, key_map))<|docstring|>Add a mapping of keys to terms within this ontology.<|endoftext|> |
8e5c5c76fd57b497945604c741d801ba5b9b46fa4d3908a6129b92802a126781 | def normalized_terms(self):
'Retrieve the terms all lower cased and with extra items removed.\n '
lower_so_terms = {}
for term in self.terms:
lower_so_terms[self._normal_term(term)] = term
return lower_so_terms | Retrieve the terms all lower cased and with extra items removed. | biosql_ontologies/genbank_to_ontology.py | normalized_terms | bgruening/bcbb | 339 | python | def normalized_terms(self):
'\n '
lower_so_terms = {}
for term in self.terms:
lower_so_terms[self._normal_term(term)] = term
return lower_so_terms | def normalized_terms(self):
'\n '
lower_so_terms = {}
for term in self.terms:
lower_so_terms[self._normal_term(term)] = term
return lower_so_terms<|docstring|>Retrieve the terms all lower cased and with extra items removed.<|endoftext|> |
d628f64c4b1285fd5d09f995e6b2bb3f28f9292e475d7cc43f7d5f86ba6cb4f2 | def send_to_server(df):
'\n Posts GUI info to server and runs through all endpoints to ultimately\n return the required data for display\n Args:\n df: Dictionary of GUI info\n\n Returns: The output of the new_user endpoint (see documentation)\n '
comms = read_comms()
send_address = comms[1]
encoded_images = encode_images_from_file(df['load_filenames'])
try:
json_dict = requests.post((send_address + '/new_user'), json={'email': df['email'], 'hist': df['hist'], 'cont': df['cont'], 'log': df['log'], 'rev': df['rev'], 'gamma': df['gamma'], 'images': encoded_images}).json()
except BaseException:
return 'Server unavailable!'
json_dict['proc_im'] = decode_images(json_dict['proc_im'])
print(json_dict['proc_im'])
return json_dict | Posts GUI info to server and runs through all endpoints to ultimately
return the required data for display
Args:
df: Dictionary of GUI info
Returns: The output of the new_user endpoint (see documentation) | ClientFunctions/communication.py | send_to_server | mdholbrook/bme590final | 1 | python | def send_to_server(df):
'\n Posts GUI info to server and runs through all endpoints to ultimately\n return the required data for display\n Args:\n df: Dictionary of GUI info\n\n Returns: The output of the new_user endpoint (see documentation)\n '
comms = read_comms()
send_address = comms[1]
encoded_images = encode_images_from_file(df['load_filenames'])
try:
json_dict = requests.post((send_address + '/new_user'), json={'email': df['email'], 'hist': df['hist'], 'cont': df['cont'], 'log': df['log'], 'rev': df['rev'], 'gamma': df['gamma'], 'images': encoded_images}).json()
except BaseException:
return 'Server unavailable!'
json_dict['proc_im'] = decode_images(json_dict['proc_im'])
print(json_dict['proc_im'])
return json_dict | def send_to_server(df):
'\n Posts GUI info to server and runs through all endpoints to ultimately\n return the required data for display\n Args:\n df: Dictionary of GUI info\n\n Returns: The output of the new_user endpoint (see documentation)\n '
comms = read_comms()
send_address = comms[1]
encoded_images = encode_images_from_file(df['load_filenames'])
try:
json_dict = requests.post((send_address + '/new_user'), json={'email': df['email'], 'hist': df['hist'], 'cont': df['cont'], 'log': df['log'], 'rev': df['rev'], 'gamma': df['gamma'], 'images': encoded_images}).json()
except BaseException:
return 'Server unavailable!'
json_dict['proc_im'] = decode_images(json_dict['proc_im'])
print(json_dict['proc_im'])
return json_dict<|docstring|>Posts GUI info to server and runs through all endpoints to ultimately
return the required data for display
Args:
df: Dictionary of GUI info
Returns: The output of the new_user endpoint (see documentation)<|endoftext|> |
f73684ca0757fa550aa46d59b8e7cb8a98302ec14b7cf7dfbd15271d92931f9c | async def add(self, owner_id: int, name: str, description: str, category_id: int, return_raw_response: bool=False, price: typing.Optional[int]=None, old_price: typing.Optional[int]=None, deleted: typing.Optional[BaseBoolInt]=None, main_photo_id: typing.Optional[int]=None, photo_ids: typing.Optional[typing.List[int]]=None, url: typing.Optional[str]=None, dimension_width: typing.Optional[int]=None, dimension_height: typing.Optional[int]=None, dimension_length: typing.Optional[int]=None, weight: typing.Optional[int]=None, sku: typing.Optional[str]=None) -> typing.Union[(dict, MarketAddResponse)]:
"\n :param owner_id: - ID of an item owner community.\n :param name: - Item name.\n :param description: - Item description.\n :param category_id: - Item category ID.\n :param price: - Item price.\n :param old_price:\n :param deleted: - Item status ('1' β deleted, '0' β not deleted).\n :param main_photo_id: - Cover photo ID.\n :param photo_ids: - IDs of additional photos.\n :param url: - Url for button in market item.\n :param dimension_width:\n :param dimension_height:\n :param dimension_length:\n :param weight:\n :param sku: - string, maximum length 50\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('add', params))
if return_raw_response:
return raw_result
result = MarketAddResponse(**raw_result)
return result | :param owner_id: - ID of an item owner community.
:param name: - Item name.
:param description: - Item description.
:param category_id: - Item category ID.
:param price: - Item price.
:param old_price:
:param deleted: - Item status ('1' β deleted, '0' β not deleted).
:param main_photo_id: - Cover photo ID.
:param photo_ids: - IDs of additional photos.
:param url: - Url for button in market item.
:param dimension_width:
:param dimension_height:
:param dimension_length:
:param weight:
:param sku: - string, maximum length 50
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | add | amishakov/vkwave | 222 | python | async def add(self, owner_id: int, name: str, description: str, category_id: int, return_raw_response: bool=False, price: typing.Optional[int]=None, old_price: typing.Optional[int]=None, deleted: typing.Optional[BaseBoolInt]=None, main_photo_id: typing.Optional[int]=None, photo_ids: typing.Optional[typing.List[int]]=None, url: typing.Optional[str]=None, dimension_width: typing.Optional[int]=None, dimension_height: typing.Optional[int]=None, dimension_length: typing.Optional[int]=None, weight: typing.Optional[int]=None, sku: typing.Optional[str]=None) -> typing.Union[(dict, MarketAddResponse)]:
"\n :param owner_id: - ID of an item owner community.\n :param name: - Item name.\n :param description: - Item description.\n :param category_id: - Item category ID.\n :param price: - Item price.\n :param old_price:\n :param deleted: - Item status ('1' β deleted, '0' β not deleted).\n :param main_photo_id: - Cover photo ID.\n :param photo_ids: - IDs of additional photos.\n :param url: - Url for button in market item.\n :param dimension_width:\n :param dimension_height:\n :param dimension_length:\n :param weight:\n :param sku: - string, maximum length 50\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('add', params))
if return_raw_response:
return raw_result
result = MarketAddResponse(**raw_result)
return result | async def add(self, owner_id: int, name: str, description: str, category_id: int, return_raw_response: bool=False, price: typing.Optional[int]=None, old_price: typing.Optional[int]=None, deleted: typing.Optional[BaseBoolInt]=None, main_photo_id: typing.Optional[int]=None, photo_ids: typing.Optional[typing.List[int]]=None, url: typing.Optional[str]=None, dimension_width: typing.Optional[int]=None, dimension_height: typing.Optional[int]=None, dimension_length: typing.Optional[int]=None, weight: typing.Optional[int]=None, sku: typing.Optional[str]=None) -> typing.Union[(dict, MarketAddResponse)]:
"\n :param owner_id: - ID of an item owner community.\n :param name: - Item name.\n :param description: - Item description.\n :param category_id: - Item category ID.\n :param price: - Item price.\n :param old_price:\n :param deleted: - Item status ('1' β deleted, '0' β not deleted).\n :param main_photo_id: - Cover photo ID.\n :param photo_ids: - IDs of additional photos.\n :param url: - Url for button in market item.\n :param dimension_width:\n :param dimension_height:\n :param dimension_length:\n :param weight:\n :param sku: - string, maximum length 50\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('add', params))
if return_raw_response:
return raw_result
result = MarketAddResponse(**raw_result)
return result<|docstring|>:param owner_id: - ID of an item owner community.
:param name: - Item name.
:param description: - Item description.
:param category_id: - Item category ID.
:param price: - Item price.
:param old_price:
:param deleted: - Item status ('1' β deleted, '0' β not deleted).
:param main_photo_id: - Cover photo ID.
:param photo_ids: - IDs of additional photos.
:param url: - Url for button in market item.
:param dimension_width:
:param dimension_height:
:param dimension_length:
:param weight:
:param sku: - string, maximum length 50
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
2fab9d901d08b71fad7d6fa51c4bfbc9a68e90e9dd2363c3bd604fa29c781261 | async def add_album(self, owner_id: int, title: str, return_raw_response: bool=False, photo_id: typing.Optional[int]=None, main_album: typing.Optional[BaseBoolInt]=None) -> typing.Union[(dict, MarketAddAlbumResponse)]:
"\n :param owner_id: - ID of an item owner community.\n :param title: - Collection title.\n :param photo_id: - Cover photo ID.\n :param main_album: - Set as main ('1' β set, '0' β no).\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('addAlbum', params))
if return_raw_response:
return raw_result
result = MarketAddAlbumResponse(**raw_result)
return result | :param owner_id: - ID of an item owner community.
:param title: - Collection title.
:param photo_id: - Cover photo ID.
:param main_album: - Set as main ('1' β set, '0' β no).
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | add_album | amishakov/vkwave | 222 | python | async def add_album(self, owner_id: int, title: str, return_raw_response: bool=False, photo_id: typing.Optional[int]=None, main_album: typing.Optional[BaseBoolInt]=None) -> typing.Union[(dict, MarketAddAlbumResponse)]:
"\n :param owner_id: - ID of an item owner community.\n :param title: - Collection title.\n :param photo_id: - Cover photo ID.\n :param main_album: - Set as main ('1' β set, '0' β no).\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('addAlbum', params))
if return_raw_response:
return raw_result
result = MarketAddAlbumResponse(**raw_result)
return result | async def add_album(self, owner_id: int, title: str, return_raw_response: bool=False, photo_id: typing.Optional[int]=None, main_album: typing.Optional[BaseBoolInt]=None) -> typing.Union[(dict, MarketAddAlbumResponse)]:
"\n :param owner_id: - ID of an item owner community.\n :param title: - Collection title.\n :param photo_id: - Cover photo ID.\n :param main_album: - Set as main ('1' β set, '0' β no).\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('addAlbum', params))
if return_raw_response:
return raw_result
result = MarketAddAlbumResponse(**raw_result)
return result<|docstring|>:param owner_id: - ID of an item owner community.
:param title: - Collection title.
:param photo_id: - Cover photo ID.
:param main_album: - Set as main ('1' β set, '0' β no).
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
a163fb75095091ba9e7e9f2c3cf6752b8630996b09b4ab417cc5554daec3f219 | async def add_to_album(self, owner_id: int, item_id: int, album_ids: typing.List[int], return_raw_response: bool=False) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param item_id: - Item ID.\n :param album_ids: - Collections IDs to add item to.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('addToAlbum', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | :param owner_id: - ID of an item owner community.
:param item_id: - Item ID.
:param album_ids: - Collections IDs to add item to.
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | add_to_album | amishakov/vkwave | 222 | python | async def add_to_album(self, owner_id: int, item_id: int, album_ids: typing.List[int], return_raw_response: bool=False) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param item_id: - Item ID.\n :param album_ids: - Collections IDs to add item to.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('addToAlbum', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | async def add_to_album(self, owner_id: int, item_id: int, album_ids: typing.List[int], return_raw_response: bool=False) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param item_id: - Item ID.\n :param album_ids: - Collections IDs to add item to.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('addToAlbum', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result<|docstring|>:param owner_id: - ID of an item owner community.
:param item_id: - Item ID.
:param album_ids: - Collections IDs to add item to.
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
6918fd6d49b2d5ff9c140d828c9adafc35a1a91412eb059076ae6e74903cba6c | async def create_comment(self, owner_id: int, item_id: int, return_raw_response: bool=False, message: typing.Optional[str]=None, attachments: typing.Optional[typing.List[str]]=None, from_group: typing.Optional[BaseBoolInt]=None, reply_to_comment: typing.Optional[int]=None, sticker_id: typing.Optional[int]=None, guid: typing.Optional[str]=None) -> typing.Union[(dict, MarketCreateCommentResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param item_id: - Item ID.\n :param message: - Comment text (required if \'attachments\' parameter is not specified)\n :param attachments: - Comma-separated list of objects attached to a comment. The field is submitted the following way: , "\'<owner_id>_<media_id>,<owner_id>_<media_id>\'", , \'\' - media attachment type: "\'photo\' - photo, \'video\' - video, \'audio\' - audio, \'doc\' - document", , \'<owner_id>\' - media owner id, \'<media_id>\' - media attachment id, , For example: "photo100172_166443618,photo66748_265827614",\n :param from_group: - \'1\' - comment will be published on behalf of a community, \'0\' - on behalf of a user (by default).\n :param reply_to_comment: - ID of a comment to reply with current comment to.\n :param sticker_id: - Sticker ID.\n :param guid: - Random value to avoid resending one comment.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('createComment', params))
if return_raw_response:
return raw_result
result = MarketCreateCommentResponse(**raw_result)
return result | :param owner_id: - ID of an item owner community.
:param item_id: - Item ID.
:param message: - Comment text (required if 'attachments' parameter is not specified)
:param attachments: - Comma-separated list of objects attached to a comment. The field is submitted the following way: , "'<owner_id>_<media_id>,<owner_id>_<media_id>'", , '' - media attachment type: "'photo' - photo, 'video' - video, 'audio' - audio, 'doc' - document", , '<owner_id>' - media owner id, '<media_id>' - media attachment id, , For example: "photo100172_166443618,photo66748_265827614",
:param from_group: - '1' - comment will be published on behalf of a community, '0' - on behalf of a user (by default).
:param reply_to_comment: - ID of a comment to reply with current comment to.
:param sticker_id: - Sticker ID.
:param guid: - Random value to avoid resending one comment.
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | create_comment | amishakov/vkwave | 222 | python | async def create_comment(self, owner_id: int, item_id: int, return_raw_response: bool=False, message: typing.Optional[str]=None, attachments: typing.Optional[typing.List[str]]=None, from_group: typing.Optional[BaseBoolInt]=None, reply_to_comment: typing.Optional[int]=None, sticker_id: typing.Optional[int]=None, guid: typing.Optional[str]=None) -> typing.Union[(dict, MarketCreateCommentResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param item_id: - Item ID.\n :param message: - Comment text (required if \'attachments\' parameter is not specified)\n :param attachments: - Comma-separated list of objects attached to a comment. The field is submitted the following way: , "\'<owner_id>_<media_id>,<owner_id>_<media_id>\'", , \'\' - media attachment type: "\'photo\' - photo, \'video\' - video, \'audio\' - audio, \'doc\' - document", , \'<owner_id>\' - media owner id, \'<media_id>\' - media attachment id, , For example: "photo100172_166443618,photo66748_265827614",\n :param from_group: - \'1\' - comment will be published on behalf of a community, \'0\' - on behalf of a user (by default).\n :param reply_to_comment: - ID of a comment to reply with current comment to.\n :param sticker_id: - Sticker ID.\n :param guid: - Random value to avoid resending one comment.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('createComment', params))
if return_raw_response:
return raw_result
result = MarketCreateCommentResponse(**raw_result)
return result | async def create_comment(self, owner_id: int, item_id: int, return_raw_response: bool=False, message: typing.Optional[str]=None, attachments: typing.Optional[typing.List[str]]=None, from_group: typing.Optional[BaseBoolInt]=None, reply_to_comment: typing.Optional[int]=None, sticker_id: typing.Optional[int]=None, guid: typing.Optional[str]=None) -> typing.Union[(dict, MarketCreateCommentResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param item_id: - Item ID.\n :param message: - Comment text (required if \'attachments\' parameter is not specified)\n :param attachments: - Comma-separated list of objects attached to a comment. The field is submitted the following way: , "\'<owner_id>_<media_id>,<owner_id>_<media_id>\'", , \'\' - media attachment type: "\'photo\' - photo, \'video\' - video, \'audio\' - audio, \'doc\' - document", , \'<owner_id>\' - media owner id, \'<media_id>\' - media attachment id, , For example: "photo100172_166443618,photo66748_265827614",\n :param from_group: - \'1\' - comment will be published on behalf of a community, \'0\' - on behalf of a user (by default).\n :param reply_to_comment: - ID of a comment to reply with current comment to.\n :param sticker_id: - Sticker ID.\n :param guid: - Random value to avoid resending one comment.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('createComment', params))
if return_raw_response:
return raw_result
result = MarketCreateCommentResponse(**raw_result)
return result<|docstring|>:param owner_id: - ID of an item owner community.
:param item_id: - Item ID.
:param message: - Comment text (required if 'attachments' parameter is not specified)
:param attachments: - Comma-separated list of objects attached to a comment. The field is submitted the following way: , "'<owner_id>_<media_id>,<owner_id>_<media_id>'", , '' - media attachment type: "'photo' - photo, 'video' - video, 'audio' - audio, 'doc' - document", , '<owner_id>' - media owner id, '<media_id>' - media attachment id, , For example: "photo100172_166443618,photo66748_265827614",
:param from_group: - '1' - comment will be published on behalf of a community, '0' - on behalf of a user (by default).
:param reply_to_comment: - ID of a comment to reply with current comment to.
:param sticker_id: - Sticker ID.
:param guid: - Random value to avoid resending one comment.
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
3cd42e920540ae73ba7d1121c83ddcbb1962a237e99526c020151649b461ebaa | async def delete(self, owner_id: int, item_id: int, return_raw_response: bool=False) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param item_id: - Item ID.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('delete', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | :param owner_id: - ID of an item owner community.
:param item_id: - Item ID.
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | delete | amishakov/vkwave | 222 | python | async def delete(self, owner_id: int, item_id: int, return_raw_response: bool=False) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param item_id: - Item ID.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('delete', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | async def delete(self, owner_id: int, item_id: int, return_raw_response: bool=False) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param item_id: - Item ID.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('delete', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result<|docstring|>:param owner_id: - ID of an item owner community.
:param item_id: - Item ID.
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
2ac5034154a20f1695d430466296ff205ae03ac40e2e17045373eb4bd71a250b | async def delete_album(self, owner_id: int, album_id: int, return_raw_response: bool=False) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an collection owner community.\n :param album_id: - Collection ID.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('deleteAlbum', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | :param owner_id: - ID of an collection owner community.
:param album_id: - Collection ID.
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | delete_album | amishakov/vkwave | 222 | python | async def delete_album(self, owner_id: int, album_id: int, return_raw_response: bool=False) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an collection owner community.\n :param album_id: - Collection ID.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('deleteAlbum', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | async def delete_album(self, owner_id: int, album_id: int, return_raw_response: bool=False) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an collection owner community.\n :param album_id: - Collection ID.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('deleteAlbum', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result<|docstring|>:param owner_id: - ID of an collection owner community.
:param album_id: - Collection ID.
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
a625bf0daa6ea8a39946e0bf21d0524d4aba85dcf0e392743c2a4560a4a78b88 | async def delete_comment(self, owner_id: int, comment_id: int, return_raw_response: bool=False) -> typing.Union[(dict, MarketDeleteCommentResponse)]:
'\n :param owner_id: - identifier of an item owner community, "Note that community id in the \'owner_id\' parameter should be negative number. For example \'owner_id\'=-1 matches the [vk.com/apiclub|VK API] community "\n :param comment_id: - comment id\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('deleteComment', params))
if return_raw_response:
return raw_result
result = MarketDeleteCommentResponse(**raw_result)
return result | :param owner_id: - identifier of an item owner community, "Note that community id in the 'owner_id' parameter should be negative number. For example 'owner_id'=-1 matches the [vk.com/apiclub|VK API] community "
:param comment_id: - comment id
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | delete_comment | amishakov/vkwave | 222 | python | async def delete_comment(self, owner_id: int, comment_id: int, return_raw_response: bool=False) -> typing.Union[(dict, MarketDeleteCommentResponse)]:
'\n :param owner_id: - identifier of an item owner community, "Note that community id in the \'owner_id\' parameter should be negative number. For example \'owner_id\'=-1 matches the [vk.com/apiclub|VK API] community "\n :param comment_id: - comment id\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('deleteComment', params))
if return_raw_response:
return raw_result
result = MarketDeleteCommentResponse(**raw_result)
return result | async def delete_comment(self, owner_id: int, comment_id: int, return_raw_response: bool=False) -> typing.Union[(dict, MarketDeleteCommentResponse)]:
'\n :param owner_id: - identifier of an item owner community, "Note that community id in the \'owner_id\' parameter should be negative number. For example \'owner_id\'=-1 matches the [vk.com/apiclub|VK API] community "\n :param comment_id: - comment id\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('deleteComment', params))
if return_raw_response:
return raw_result
result = MarketDeleteCommentResponse(**raw_result)
return result<|docstring|>:param owner_id: - identifier of an item owner community, "Note that community id in the 'owner_id' parameter should be negative number. For example 'owner_id'=-1 matches the [vk.com/apiclub|VK API] community "
:param comment_id: - comment id
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
1bed784e7ece25f3f4d8c2cd02a347f7790151245e10937d3d5cb6ae65ac553a | async def edit(self, owner_id: int, item_id: int, name: str, description: str, category_id: int, price: int, main_photo_id: int, return_raw_response: bool=False, deleted: typing.Optional[BaseBoolInt]=None, photo_ids: typing.Optional[typing.List[int]]=None, url: typing.Optional[str]=None, sku: typing.Optional[str]=None) -> typing.Union[(dict, BaseOkResponse)]:
"\n :param owner_id: - ID of an item owner community.\n :param item_id: - Item ID.\n :param name: - Item name.\n :param description: - Item description.\n :param category_id: - Item category ID.\n :param price: - Item price.\n :param deleted: - Item status ('1' β deleted, '0' β not deleted).\n :param main_photo_id: - Cover photo ID.\n :param photo_ids: - IDs of additional photos.\n :param url: - Url for button in market item.\n :param sku: - string, maximum length 50\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('edit', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | :param owner_id: - ID of an item owner community.
:param item_id: - Item ID.
:param name: - Item name.
:param description: - Item description.
:param category_id: - Item category ID.
:param price: - Item price.
:param deleted: - Item status ('1' β deleted, '0' β not deleted).
:param main_photo_id: - Cover photo ID.
:param photo_ids: - IDs of additional photos.
:param url: - Url for button in market item.
:param sku: - string, maximum length 50
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | edit | amishakov/vkwave | 222 | python | async def edit(self, owner_id: int, item_id: int, name: str, description: str, category_id: int, price: int, main_photo_id: int, return_raw_response: bool=False, deleted: typing.Optional[BaseBoolInt]=None, photo_ids: typing.Optional[typing.List[int]]=None, url: typing.Optional[str]=None, sku: typing.Optional[str]=None) -> typing.Union[(dict, BaseOkResponse)]:
"\n :param owner_id: - ID of an item owner community.\n :param item_id: - Item ID.\n :param name: - Item name.\n :param description: - Item description.\n :param category_id: - Item category ID.\n :param price: - Item price.\n :param deleted: - Item status ('1' β deleted, '0' β not deleted).\n :param main_photo_id: - Cover photo ID.\n :param photo_ids: - IDs of additional photos.\n :param url: - Url for button in market item.\n :param sku: - string, maximum length 50\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('edit', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | async def edit(self, owner_id: int, item_id: int, name: str, description: str, category_id: int, price: int, main_photo_id: int, return_raw_response: bool=False, deleted: typing.Optional[BaseBoolInt]=None, photo_ids: typing.Optional[typing.List[int]]=None, url: typing.Optional[str]=None, sku: typing.Optional[str]=None) -> typing.Union[(dict, BaseOkResponse)]:
"\n :param owner_id: - ID of an item owner community.\n :param item_id: - Item ID.\n :param name: - Item name.\n :param description: - Item description.\n :param category_id: - Item category ID.\n :param price: - Item price.\n :param deleted: - Item status ('1' β deleted, '0' β not deleted).\n :param main_photo_id: - Cover photo ID.\n :param photo_ids: - IDs of additional photos.\n :param url: - Url for button in market item.\n :param sku: - string, maximum length 50\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('edit', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result<|docstring|>:param owner_id: - ID of an item owner community.
:param item_id: - Item ID.
:param name: - Item name.
:param description: - Item description.
:param category_id: - Item category ID.
:param price: - Item price.
:param deleted: - Item status ('1' β deleted, '0' β not deleted).
:param main_photo_id: - Cover photo ID.
:param photo_ids: - IDs of additional photos.
:param url: - Url for button in market item.
:param sku: - string, maximum length 50
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
d5af02f51569cf785308ebfad835a335f71cea9a94f33365bd3d6af494854c0d | async def edit_album(self, owner_id: int, album_id: int, title: str, return_raw_response: bool=False, photo_id: typing.Optional[int]=None, main_album: typing.Optional[BaseBoolInt]=None) -> typing.Union[(dict, BaseOkResponse)]:
"\n :param owner_id: - ID of an collection owner community.\n :param album_id: - Collection ID.\n :param title: - Collection title.\n :param photo_id: - Cover photo id\n :param main_album: - Set as main ('1' β set, '0' β no).\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('editAlbum', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | :param owner_id: - ID of an collection owner community.
:param album_id: - Collection ID.
:param title: - Collection title.
:param photo_id: - Cover photo id
:param main_album: - Set as main ('1' β set, '0' β no).
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | edit_album | amishakov/vkwave | 222 | python | async def edit_album(self, owner_id: int, album_id: int, title: str, return_raw_response: bool=False, photo_id: typing.Optional[int]=None, main_album: typing.Optional[BaseBoolInt]=None) -> typing.Union[(dict, BaseOkResponse)]:
"\n :param owner_id: - ID of an collection owner community.\n :param album_id: - Collection ID.\n :param title: - Collection title.\n :param photo_id: - Cover photo id\n :param main_album: - Set as main ('1' β set, '0' β no).\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('editAlbum', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | async def edit_album(self, owner_id: int, album_id: int, title: str, return_raw_response: bool=False, photo_id: typing.Optional[int]=None, main_album: typing.Optional[BaseBoolInt]=None) -> typing.Union[(dict, BaseOkResponse)]:
"\n :param owner_id: - ID of an collection owner community.\n :param album_id: - Collection ID.\n :param title: - Collection title.\n :param photo_id: - Cover photo id\n :param main_album: - Set as main ('1' β set, '0' β no).\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('editAlbum', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result<|docstring|>:param owner_id: - ID of an collection owner community.
:param album_id: - Collection ID.
:param title: - Collection title.
:param photo_id: - Cover photo id
:param main_album: - Set as main ('1' β set, '0' β no).
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
3b1b3c531ea44fe9024cc32ed552fdcabd6a78c45ba9e474214f7d4dd227f98a | async def edit_comment(self, owner_id: int, comment_id: int, return_raw_response: bool=False, message: typing.Optional[str]=None, attachments: typing.Optional[typing.List[str]]=None) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param comment_id: - Comment ID.\n :param message: - New comment text (required if \'attachments\' are not specified), , 2048 symbols maximum.\n :param attachments: - Comma-separated list of objects attached to a comment. The field is submitted the following way: , "\'<owner_id>_<media_id>,<owner_id>_<media_id>\'", , \'\' - media attachment type: "\'photo\' - photo, \'video\' - video, \'audio\' - audio, \'doc\' - document", , \'<owner_id>\' - media owner id, \'<media_id>\' - media attachment id, , For example: "photo100172_166443618,photo66748_265827614",\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('editComment', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | :param owner_id: - ID of an item owner community.
:param comment_id: - Comment ID.
:param message: - New comment text (required if 'attachments' are not specified), , 2048 symbols maximum.
:param attachments: - Comma-separated list of objects attached to a comment. The field is submitted the following way: , "'<owner_id>_<media_id>,<owner_id>_<media_id>'", , '' - media attachment type: "'photo' - photo, 'video' - video, 'audio' - audio, 'doc' - document", , '<owner_id>' - media owner id, '<media_id>' - media attachment id, , For example: "photo100172_166443618,photo66748_265827614",
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | edit_comment | amishakov/vkwave | 222 | python | async def edit_comment(self, owner_id: int, comment_id: int, return_raw_response: bool=False, message: typing.Optional[str]=None, attachments: typing.Optional[typing.List[str]]=None) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param comment_id: - Comment ID.\n :param message: - New comment text (required if \'attachments\' are not specified), , 2048 symbols maximum.\n :param attachments: - Comma-separated list of objects attached to a comment. The field is submitted the following way: , "\'<owner_id>_<media_id>,<owner_id>_<media_id>\'", , \'\' - media attachment type: "\'photo\' - photo, \'video\' - video, \'audio\' - audio, \'doc\' - document", , \'<owner_id>\' - media owner id, \'<media_id>\' - media attachment id, , For example: "photo100172_166443618,photo66748_265827614",\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('editComment', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | async def edit_comment(self, owner_id: int, comment_id: int, return_raw_response: bool=False, message: typing.Optional[str]=None, attachments: typing.Optional[typing.List[str]]=None) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param comment_id: - Comment ID.\n :param message: - New comment text (required if \'attachments\' are not specified), , 2048 symbols maximum.\n :param attachments: - Comma-separated list of objects attached to a comment. The field is submitted the following way: , "\'<owner_id>_<media_id>,<owner_id>_<media_id>\'", , \'\' - media attachment type: "\'photo\' - photo, \'video\' - video, \'audio\' - audio, \'doc\' - document", , \'<owner_id>\' - media owner id, \'<media_id>\' - media attachment id, , For example: "photo100172_166443618,photo66748_265827614",\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('editComment', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result<|docstring|>:param owner_id: - ID of an item owner community.
:param comment_id: - Comment ID.
:param message: - New comment text (required if 'attachments' are not specified), , 2048 symbols maximum.
:param attachments: - Comma-separated list of objects attached to a comment. The field is submitted the following way: , "'<owner_id>_<media_id>,<owner_id>_<media_id>'", , '' - media attachment type: "'photo' - photo, 'video' - video, 'audio' - audio, 'doc' - document", , '<owner_id>' - media owner id, '<media_id>' - media attachment id, , For example: "photo100172_166443618,photo66748_265827614",
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
d3d0329f8c159de8ddf2c4efd79653a9dfa39f016f0df78a65a274581d7675aa | async def edit_order(self, user_id: int, order_id: int, return_raw_response: bool=False, merchant_comment: typing.Optional[str]=None, status: typing.Optional[int]=None, track_number: typing.Optional[str]=None, payment_status: typing.Optional[str]=None, delivery_price: typing.Optional[int]=None, width: typing.Optional[int]=None, lenght: typing.Optional[int]=None, height: typing.Optional[int]=None, weight: typing.Optional[int]=None, comment_for_user: typing.Optional[str]=None, receipt_link: typing.Optional[str]=None) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param user_id: - int (number), minimum value 1, required parameter\n :param order_id: - positive number, required parameter\n :param merchant_comment: - string, maximum length 800\n :param status: - positive number\n :param track_number: - string, maximum length 60, accessible for versions from 5.130\n :param payment_status: - string, accessible for versions from 5.130\n :param delivery_price: - positive number, accessible for versions from 5.130\n :param width: - positive number, maximum value 100000, accessible for versions from 5.130\n :param lenght: - positive number, maximum value 100000, accessible for versions from 5.130\n :param height: - positive number, maximum value 100000, accessible for versions from 5.130\n :param weight: - positive number, maximum value 100000000, accessible for versions from 5.13\n :param comment_for_user: - string, maximum length 400, accessible for versions from 5.139\n :param receipt_link: - string, maximum length 400, accessible for versions from 5.159\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('editOrder', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | :param user_id: - int (number), minimum value 1, required parameter
:param order_id: - positive number, required parameter
:param merchant_comment: - string, maximum length 800
:param status: - positive number
:param track_number: - string, maximum length 60, accessible for versions from 5.130
:param payment_status: - string, accessible for versions from 5.130
:param delivery_price: - positive number, accessible for versions from 5.130
:param width: - positive number, maximum value 100000, accessible for versions from 5.130
:param lenght: - positive number, maximum value 100000, accessible for versions from 5.130
:param height: - positive number, maximum value 100000, accessible for versions from 5.130
:param weight: - positive number, maximum value 100000000, accessible for versions from 5.13
:param comment_for_user: - string, maximum length 400, accessible for versions from 5.139
:param receipt_link: - string, maximum length 400, accessible for versions from 5.159
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | edit_order | amishakov/vkwave | 222 | python | async def edit_order(self, user_id: int, order_id: int, return_raw_response: bool=False, merchant_comment: typing.Optional[str]=None, status: typing.Optional[int]=None, track_number: typing.Optional[str]=None, payment_status: typing.Optional[str]=None, delivery_price: typing.Optional[int]=None, width: typing.Optional[int]=None, lenght: typing.Optional[int]=None, height: typing.Optional[int]=None, weight: typing.Optional[int]=None, comment_for_user: typing.Optional[str]=None, receipt_link: typing.Optional[str]=None) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param user_id: - int (number), minimum value 1, required parameter\n :param order_id: - positive number, required parameter\n :param merchant_comment: - string, maximum length 800\n :param status: - positive number\n :param track_number: - string, maximum length 60, accessible for versions from 5.130\n :param payment_status: - string, accessible for versions from 5.130\n :param delivery_price: - positive number, accessible for versions from 5.130\n :param width: - positive number, maximum value 100000, accessible for versions from 5.130\n :param lenght: - positive number, maximum value 100000, accessible for versions from 5.130\n :param height: - positive number, maximum value 100000, accessible for versions from 5.130\n :param weight: - positive number, maximum value 100000000, accessible for versions from 5.13\n :param comment_for_user: - string, maximum length 400, accessible for versions from 5.139\n :param receipt_link: - string, maximum length 400, accessible for versions from 5.159\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('editOrder', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | async def edit_order(self, user_id: int, order_id: int, return_raw_response: bool=False, merchant_comment: typing.Optional[str]=None, status: typing.Optional[int]=None, track_number: typing.Optional[str]=None, payment_status: typing.Optional[str]=None, delivery_price: typing.Optional[int]=None, width: typing.Optional[int]=None, lenght: typing.Optional[int]=None, height: typing.Optional[int]=None, weight: typing.Optional[int]=None, comment_for_user: typing.Optional[str]=None, receipt_link: typing.Optional[str]=None) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param user_id: - int (number), minimum value 1, required parameter\n :param order_id: - positive number, required parameter\n :param merchant_comment: - string, maximum length 800\n :param status: - positive number\n :param track_number: - string, maximum length 60, accessible for versions from 5.130\n :param payment_status: - string, accessible for versions from 5.130\n :param delivery_price: - positive number, accessible for versions from 5.130\n :param width: - positive number, maximum value 100000, accessible for versions from 5.130\n :param lenght: - positive number, maximum value 100000, accessible for versions from 5.130\n :param height: - positive number, maximum value 100000, accessible for versions from 5.130\n :param weight: - positive number, maximum value 100000000, accessible for versions from 5.13\n :param comment_for_user: - string, maximum length 400, accessible for versions from 5.139\n :param receipt_link: - string, maximum length 400, accessible for versions from 5.159\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('editOrder', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result<|docstring|>:param user_id: - int (number), minimum value 1, required parameter
:param order_id: - positive number, required parameter
:param merchant_comment: - string, maximum length 800
:param status: - positive number
:param track_number: - string, maximum length 60, accessible for versions from 5.130
:param payment_status: - string, accessible for versions from 5.130
:param delivery_price: - positive number, accessible for versions from 5.130
:param width: - positive number, maximum value 100000, accessible for versions from 5.130
:param lenght: - positive number, maximum value 100000, accessible for versions from 5.130
:param height: - positive number, maximum value 100000, accessible for versions from 5.130
:param weight: - positive number, maximum value 100000000, accessible for versions from 5.13
:param comment_for_user: - string, maximum length 400, accessible for versions from 5.139
:param receipt_link: - string, maximum length 400, accessible for versions from 5.159
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
5203e89c1b3a38895304b192a23950b09d8109de82574525cb5c7c16ea0b690b | async def get(self, owner_id: int, return_raw_response: bool=False, album_id: typing.Optional[int]=None, count: typing.Optional[int]=None, offset: typing.Optional[int]=None, extended: typing.Optional[BaseBoolInt]=None) -> typing.Union[(dict, MarketGetResponse, MarketGetExtendedResponse)]:
'\n :param owner_id: - ID of an item owner community, "Note that community id in the \'owner_id\' parameter should be negative number. For example \'owner_id\'=-1 matches the [vk.com/apiclub|VK API] community "\n :param album_id:\n :param count: - Number of items to return.\n :param offset: - Offset needed to return a specific subset of results.\n :param extended: - \'1\' β method will return additional fields: \'likes, can_comment, car_repost, photos\'. These parameters are not returned by default.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('get', params))
if return_raw_response:
return raw_result
result = (MarketGetResponse(**raw_result) if (not extended) else MarketGetExtendedResponse(**raw_result))
return result | :param owner_id: - ID of an item owner community, "Note that community id in the 'owner_id' parameter should be negative number. For example 'owner_id'=-1 matches the [vk.com/apiclub|VK API] community "
:param album_id:
:param count: - Number of items to return.
:param offset: - Offset needed to return a specific subset of results.
:param extended: - '1' β method will return additional fields: 'likes, can_comment, car_repost, photos'. These parameters are not returned by default.
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | get | amishakov/vkwave | 222 | python | async def get(self, owner_id: int, return_raw_response: bool=False, album_id: typing.Optional[int]=None, count: typing.Optional[int]=None, offset: typing.Optional[int]=None, extended: typing.Optional[BaseBoolInt]=None) -> typing.Union[(dict, MarketGetResponse, MarketGetExtendedResponse)]:
'\n :param owner_id: - ID of an item owner community, "Note that community id in the \'owner_id\' parameter should be negative number. For example \'owner_id\'=-1 matches the [vk.com/apiclub|VK API] community "\n :param album_id:\n :param count: - Number of items to return.\n :param offset: - Offset needed to return a specific subset of results.\n :param extended: - \'1\' β method will return additional fields: \'likes, can_comment, car_repost, photos\'. These parameters are not returned by default.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('get', params))
if return_raw_response:
return raw_result
result = (MarketGetResponse(**raw_result) if (not extended) else MarketGetExtendedResponse(**raw_result))
return result | async def get(self, owner_id: int, return_raw_response: bool=False, album_id: typing.Optional[int]=None, count: typing.Optional[int]=None, offset: typing.Optional[int]=None, extended: typing.Optional[BaseBoolInt]=None) -> typing.Union[(dict, MarketGetResponse, MarketGetExtendedResponse)]:
'\n :param owner_id: - ID of an item owner community, "Note that community id in the \'owner_id\' parameter should be negative number. For example \'owner_id\'=-1 matches the [vk.com/apiclub|VK API] community "\n :param album_id:\n :param count: - Number of items to return.\n :param offset: - Offset needed to return a specific subset of results.\n :param extended: - \'1\' β method will return additional fields: \'likes, can_comment, car_repost, photos\'. These parameters are not returned by default.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('get', params))
if return_raw_response:
return raw_result
result = (MarketGetResponse(**raw_result) if (not extended) else MarketGetExtendedResponse(**raw_result))
return result<|docstring|>:param owner_id: - ID of an item owner community, "Note that community id in the 'owner_id' parameter should be negative number. For example 'owner_id'=-1 matches the [vk.com/apiclub|VK API] community "
:param album_id:
:param count: - Number of items to return.
:param offset: - Offset needed to return a specific subset of results.
:param extended: - '1' β method will return additional fields: 'likes, can_comment, car_repost, photos'. These parameters are not returned by default.
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
cc4e8151d9c99fab760917536a7152ada59958709526c866f5d5fe72ec6df595 | async def get_album_by_id(self, owner_id: int, album_ids: typing.List[int], return_raw_response: bool=False) -> typing.Union[(dict, MarketGetAlbumByIdResponse)]:
'\n :param owner_id: - identifier of an album owner community, "Note that community id in the \'owner_id\' parameter should be negative number. For example \'owner_id\'=-1 matches the [vk.com/apiclub|VK API] community "\n :param album_ids: - collections identifiers to obtain data from\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getAlbumById', params))
if return_raw_response:
return raw_result
result = MarketGetAlbumByIdResponse(**raw_result)
return result | :param owner_id: - identifier of an album owner community, "Note that community id in the 'owner_id' parameter should be negative number. For example 'owner_id'=-1 matches the [vk.com/apiclub|VK API] community "
:param album_ids: - collections identifiers to obtain data from
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | get_album_by_id | amishakov/vkwave | 222 | python | async def get_album_by_id(self, owner_id: int, album_ids: typing.List[int], return_raw_response: bool=False) -> typing.Union[(dict, MarketGetAlbumByIdResponse)]:
'\n :param owner_id: - identifier of an album owner community, "Note that community id in the \'owner_id\' parameter should be negative number. For example \'owner_id\'=-1 matches the [vk.com/apiclub|VK API] community "\n :param album_ids: - collections identifiers to obtain data from\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getAlbumById', params))
if return_raw_response:
return raw_result
result = MarketGetAlbumByIdResponse(**raw_result)
return result | async def get_album_by_id(self, owner_id: int, album_ids: typing.List[int], return_raw_response: bool=False) -> typing.Union[(dict, MarketGetAlbumByIdResponse)]:
'\n :param owner_id: - identifier of an album owner community, "Note that community id in the \'owner_id\' parameter should be negative number. For example \'owner_id\'=-1 matches the [vk.com/apiclub|VK API] community "\n :param album_ids: - collections identifiers to obtain data from\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getAlbumById', params))
if return_raw_response:
return raw_result
result = MarketGetAlbumByIdResponse(**raw_result)
return result<|docstring|>:param owner_id: - identifier of an album owner community, "Note that community id in the 'owner_id' parameter should be negative number. For example 'owner_id'=-1 matches the [vk.com/apiclub|VK API] community "
:param album_ids: - collections identifiers to obtain data from
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
9913cd1519c1ed2816d587e7165440de9a58b2c3424a6170d0b57a32e9fafb23 | async def get_albums(self, owner_id: int, return_raw_response: bool=False, offset: typing.Optional[int]=None, count: typing.Optional[int]=None) -> typing.Union[(dict, MarketGetAlbumsResponse)]:
'\n :param owner_id: - ID of an items owner community.\n :param offset: - Offset needed to return a specific subset of results.\n :param count: - Number of items to return.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getAlbums', params))
if return_raw_response:
return raw_result
result = MarketGetAlbumsResponse(**raw_result)
return result | :param owner_id: - ID of an items owner community.
:param offset: - Offset needed to return a specific subset of results.
:param count: - Number of items to return.
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | get_albums | amishakov/vkwave | 222 | python | async def get_albums(self, owner_id: int, return_raw_response: bool=False, offset: typing.Optional[int]=None, count: typing.Optional[int]=None) -> typing.Union[(dict, MarketGetAlbumsResponse)]:
'\n :param owner_id: - ID of an items owner community.\n :param offset: - Offset needed to return a specific subset of results.\n :param count: - Number of items to return.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getAlbums', params))
if return_raw_response:
return raw_result
result = MarketGetAlbumsResponse(**raw_result)
return result | async def get_albums(self, owner_id: int, return_raw_response: bool=False, offset: typing.Optional[int]=None, count: typing.Optional[int]=None) -> typing.Union[(dict, MarketGetAlbumsResponse)]:
'\n :param owner_id: - ID of an items owner community.\n :param offset: - Offset needed to return a specific subset of results.\n :param count: - Number of items to return.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getAlbums', params))
if return_raw_response:
return raw_result
result = MarketGetAlbumsResponse(**raw_result)
return result<|docstring|>:param owner_id: - ID of an items owner community.
:param offset: - Offset needed to return a specific subset of results.
:param count: - Number of items to return.
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
54c65789c10f2c48e6c81752317d57a4d5aee3800ebd965f6e635129d791bb36 | async def get_by_id(self, item_ids: typing.List[str], return_raw_response: bool=False, extended: typing.Optional[BaseBoolInt]=None) -> typing.Union[(dict, MarketGetByIdResponse, MarketGetByIdExtendedResponse)]:
'\n :param item_ids: - Comma-separated ids list: {user id}_{item id}. If an item belongs to a community -{community id} is used. " \'Videos\' value example: , \'-4363_136089719,13245770_137352259\'"\n :param extended: - \'1\' β to return additional fields: \'likes, can_comment, car_repost, photos\'. By default: \'0\'.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getById', params))
if return_raw_response:
return raw_result
result = (MarketGetByIdResponse(**raw_result) if (not extended) else MarketGetByIdExtendedResponse(**raw_result))
return result | :param item_ids: - Comma-separated ids list: {user id}_{item id}. If an item belongs to a community -{community id} is used. " 'Videos' value example: , '-4363_136089719,13245770_137352259'"
:param extended: - '1' β to return additional fields: 'likes, can_comment, car_repost, photos'. By default: '0'.
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | get_by_id | amishakov/vkwave | 222 | python | async def get_by_id(self, item_ids: typing.List[str], return_raw_response: bool=False, extended: typing.Optional[BaseBoolInt]=None) -> typing.Union[(dict, MarketGetByIdResponse, MarketGetByIdExtendedResponse)]:
'\n :param item_ids: - Comma-separated ids list: {user id}_{item id}. If an item belongs to a community -{community id} is used. " \'Videos\' value example: , \'-4363_136089719,13245770_137352259\'"\n :param extended: - \'1\' β to return additional fields: \'likes, can_comment, car_repost, photos\'. By default: \'0\'.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getById', params))
if return_raw_response:
return raw_result
result = (MarketGetByIdResponse(**raw_result) if (not extended) else MarketGetByIdExtendedResponse(**raw_result))
return result | async def get_by_id(self, item_ids: typing.List[str], return_raw_response: bool=False, extended: typing.Optional[BaseBoolInt]=None) -> typing.Union[(dict, MarketGetByIdResponse, MarketGetByIdExtendedResponse)]:
'\n :param item_ids: - Comma-separated ids list: {user id}_{item id}. If an item belongs to a community -{community id} is used. " \'Videos\' value example: , \'-4363_136089719,13245770_137352259\'"\n :param extended: - \'1\' β to return additional fields: \'likes, can_comment, car_repost, photos\'. By default: \'0\'.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getById', params))
if return_raw_response:
return raw_result
result = (MarketGetByIdResponse(**raw_result) if (not extended) else MarketGetByIdExtendedResponse(**raw_result))
return result<|docstring|>:param item_ids: - Comma-separated ids list: {user id}_{item id}. If an item belongs to a community -{community id} is used. " 'Videos' value example: , '-4363_136089719,13245770_137352259'"
:param extended: - '1' β to return additional fields: 'likes, can_comment, car_repost, photos'. By default: '0'.
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
9c4974916c7d45514db347ac5a8a253958ed34a7ede6260304c1895f1ca7a8bf | async def get_categories(self, return_raw_response: bool=False, count: typing.Optional[int]=None, offset: typing.Optional[int]=None) -> typing.Union[(dict, MarketGetCategoriesNewResponse)]:
'\n :param count: - Number of results to return.\n :param offset: - Offset needed to return a specific subset of results.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getCategories', params))
if return_raw_response:
return raw_result
result = MarketGetCategoriesNewResponse(**raw_result)
return result | :param count: - Number of results to return.
:param offset: - Offset needed to return a specific subset of results.
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | get_categories | amishakov/vkwave | 222 | python | async def get_categories(self, return_raw_response: bool=False, count: typing.Optional[int]=None, offset: typing.Optional[int]=None) -> typing.Union[(dict, MarketGetCategoriesNewResponse)]:
'\n :param count: - Number of results to return.\n :param offset: - Offset needed to return a specific subset of results.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getCategories', params))
if return_raw_response:
return raw_result
result = MarketGetCategoriesNewResponse(**raw_result)
return result | async def get_categories(self, return_raw_response: bool=False, count: typing.Optional[int]=None, offset: typing.Optional[int]=None) -> typing.Union[(dict, MarketGetCategoriesNewResponse)]:
'\n :param count: - Number of results to return.\n :param offset: - Offset needed to return a specific subset of results.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getCategories', params))
if return_raw_response:
return raw_result
result = MarketGetCategoriesNewResponse(**raw_result)
return result<|docstring|>:param count: - Number of results to return.
:param offset: - Offset needed to return a specific subset of results.
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
991255bd4954b432d560c6ecb3acd8060cbdaa9d246ca3594e92af327c0a9855 | async def get_comments(self, owner_id: int, item_id: int, return_raw_response: bool=False, need_likes: typing.Optional[BaseBoolInt]=None, start_comment_id: typing.Optional[int]=None, offset: typing.Optional[int]=None, count: typing.Optional[int]=None, sort: typing.Optional[str]=None, extended: typing.Optional[BaseBoolInt]=None, fields: typing.Optional[typing.List[UsersFields]]=None) -> typing.Union[(dict, MarketGetCommentsResponse)]:
"\n :param owner_id: - ID of an item owner community\n :param item_id: - Item ID.\n :param need_likes: - '1' β to return likes info.\n :param start_comment_id: - ID of a comment to start a list from (details below).\n :param offset:\n :param count: - Number of results to return.\n :param sort: - Sort order ('asc' β from old to new, 'desc' β from new to old)\n :param extended: - '1' β comments will be returned as numbered objects, in addition lists of 'profiles' and 'groups' objects will be returned.\n :param fields: - List of additional profile fields to return. See the [vk.com/dev/fields|details]\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('getComments', params))
if return_raw_response:
return raw_result
result = MarketGetCommentsResponse(**raw_result)
return result | :param owner_id: - ID of an item owner community
:param item_id: - Item ID.
:param need_likes: - '1' β to return likes info.
:param start_comment_id: - ID of a comment to start a list from (details below).
:param offset:
:param count: - Number of results to return.
:param sort: - Sort order ('asc' β from old to new, 'desc' β from new to old)
:param extended: - '1' β comments will be returned as numbered objects, in addition lists of 'profiles' and 'groups' objects will be returned.
:param fields: - List of additional profile fields to return. See the [vk.com/dev/fields|details]
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | get_comments | amishakov/vkwave | 222 | python | async def get_comments(self, owner_id: int, item_id: int, return_raw_response: bool=False, need_likes: typing.Optional[BaseBoolInt]=None, start_comment_id: typing.Optional[int]=None, offset: typing.Optional[int]=None, count: typing.Optional[int]=None, sort: typing.Optional[str]=None, extended: typing.Optional[BaseBoolInt]=None, fields: typing.Optional[typing.List[UsersFields]]=None) -> typing.Union[(dict, MarketGetCommentsResponse)]:
"\n :param owner_id: - ID of an item owner community\n :param item_id: - Item ID.\n :param need_likes: - '1' β to return likes info.\n :param start_comment_id: - ID of a comment to start a list from (details below).\n :param offset:\n :param count: - Number of results to return.\n :param sort: - Sort order ('asc' β from old to new, 'desc' β from new to old)\n :param extended: - '1' β comments will be returned as numbered objects, in addition lists of 'profiles' and 'groups' objects will be returned.\n :param fields: - List of additional profile fields to return. See the [vk.com/dev/fields|details]\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('getComments', params))
if return_raw_response:
return raw_result
result = MarketGetCommentsResponse(**raw_result)
return result | async def get_comments(self, owner_id: int, item_id: int, return_raw_response: bool=False, need_likes: typing.Optional[BaseBoolInt]=None, start_comment_id: typing.Optional[int]=None, offset: typing.Optional[int]=None, count: typing.Optional[int]=None, sort: typing.Optional[str]=None, extended: typing.Optional[BaseBoolInt]=None, fields: typing.Optional[typing.List[UsersFields]]=None) -> typing.Union[(dict, MarketGetCommentsResponse)]:
"\n :param owner_id: - ID of an item owner community\n :param item_id: - Item ID.\n :param need_likes: - '1' β to return likes info.\n :param start_comment_id: - ID of a comment to start a list from (details below).\n :param offset:\n :param count: - Number of results to return.\n :param sort: - Sort order ('asc' β from old to new, 'desc' β from new to old)\n :param extended: - '1' β comments will be returned as numbered objects, in addition lists of 'profiles' and 'groups' objects will be returned.\n :param fields: - List of additional profile fields to return. See the [vk.com/dev/fields|details]\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('getComments', params))
if return_raw_response:
return raw_result
result = MarketGetCommentsResponse(**raw_result)
return result<|docstring|>:param owner_id: - ID of an item owner community
:param item_id: - Item ID.
:param need_likes: - '1' β to return likes info.
:param start_comment_id: - ID of a comment to start a list from (details below).
:param offset:
:param count: - Number of results to return.
:param sort: - Sort order ('asc' β from old to new, 'desc' β from new to old)
:param extended: - '1' β comments will be returned as numbered objects, in addition lists of 'profiles' and 'groups' objects will be returned.
:param fields: - List of additional profile fields to return. See the [vk.com/dev/fields|details]
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
7b592806962fd8f86556d4d9adf6948c1f8d512f6ad261327afd9b884dc6a7df | async def get_group_orders(self, group_id: int, return_raw_response: bool=False, offset: typing.Optional[int]=None, count: typing.Optional[int]=None) -> typing.Union[(dict, MarketGetGroupOrdersResponse)]:
'\n :param group_id:\n :param offset:\n :param count:\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getGroupOrders', params))
if return_raw_response:
return raw_result
result = MarketGetGroupOrdersResponse(**raw_result)
return result | :param group_id:
:param offset:
:param count:
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | get_group_orders | amishakov/vkwave | 222 | python | async def get_group_orders(self, group_id: int, return_raw_response: bool=False, offset: typing.Optional[int]=None, count: typing.Optional[int]=None) -> typing.Union[(dict, MarketGetGroupOrdersResponse)]:
'\n :param group_id:\n :param offset:\n :param count:\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getGroupOrders', params))
if return_raw_response:
return raw_result
result = MarketGetGroupOrdersResponse(**raw_result)
return result | async def get_group_orders(self, group_id: int, return_raw_response: bool=False, offset: typing.Optional[int]=None, count: typing.Optional[int]=None) -> typing.Union[(dict, MarketGetGroupOrdersResponse)]:
'\n :param group_id:\n :param offset:\n :param count:\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getGroupOrders', params))
if return_raw_response:
return raw_result
result = MarketGetGroupOrdersResponse(**raw_result)
return result<|docstring|>:param group_id:
:param offset:
:param count:
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
000d69da14c74f0fd536f05b857eb7be2a0e3bc3c748f0cb6d3080f6d61d553f | async def get_order_by_id(self, order_id: int, return_raw_response: bool=False, user_id: typing.Optional[int]=None, extended: typing.Optional[BaseBoolInt]=None) -> typing.Union[(dict, MarketGetOrderByIdResponse)]:
'\n :param user_id:\n :param order_id:\n :param extended:\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getOrderById', params))
if return_raw_response:
return raw_result
result = MarketGetOrderByIdResponse(**raw_result)
return result | :param user_id:
:param order_id:
:param extended:
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | get_order_by_id | amishakov/vkwave | 222 | python | async def get_order_by_id(self, order_id: int, return_raw_response: bool=False, user_id: typing.Optional[int]=None, extended: typing.Optional[BaseBoolInt]=None) -> typing.Union[(dict, MarketGetOrderByIdResponse)]:
'\n :param user_id:\n :param order_id:\n :param extended:\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getOrderById', params))
if return_raw_response:
return raw_result
result = MarketGetOrderByIdResponse(**raw_result)
return result | async def get_order_by_id(self, order_id: int, return_raw_response: bool=False, user_id: typing.Optional[int]=None, extended: typing.Optional[BaseBoolInt]=None) -> typing.Union[(dict, MarketGetOrderByIdResponse)]:
'\n :param user_id:\n :param order_id:\n :param extended:\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getOrderById', params))
if return_raw_response:
return raw_result
result = MarketGetOrderByIdResponse(**raw_result)
return result<|docstring|>:param user_id:
:param order_id:
:param extended:
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
18d20f262ed3c9b53485846a59dd02436bc0abb91c897aa442a29bc4d40647ae | async def get_order_items(self, order_id: int, return_raw_response: bool=False, offset: typing.Optional[int]=None, count: typing.Optional[int]=None, user_id: typing.Optional[int]=None) -> typing.Union[(dict, MarketGetOrderItemsResponse)]:
'\n :param order_id:\n :param offset:\n :param count:\n :param user_id:\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getOrderItems', params))
if return_raw_response:
return raw_result
result = MarketGetOrderItemsResponse(**raw_result)
return result | :param order_id:
:param offset:
:param count:
:param user_id:
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | get_order_items | amishakov/vkwave | 222 | python | async def get_order_items(self, order_id: int, return_raw_response: bool=False, offset: typing.Optional[int]=None, count: typing.Optional[int]=None, user_id: typing.Optional[int]=None) -> typing.Union[(dict, MarketGetOrderItemsResponse)]:
'\n :param order_id:\n :param offset:\n :param count:\n :param user_id:\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getOrderItems', params))
if return_raw_response:
return raw_result
result = MarketGetOrderItemsResponse(**raw_result)
return result | async def get_order_items(self, order_id: int, return_raw_response: bool=False, offset: typing.Optional[int]=None, count: typing.Optional[int]=None, user_id: typing.Optional[int]=None) -> typing.Union[(dict, MarketGetOrderItemsResponse)]:
'\n :param order_id:\n :param offset:\n :param count:\n :param user_id:\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getOrderItems', params))
if return_raw_response:
return raw_result
result = MarketGetOrderItemsResponse(**raw_result)
return result<|docstring|>:param order_id:
:param offset:
:param count:
:param user_id:
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
709fa127baa4f18ecf653802ec618605df1e50b5fcfdb8df3db12b5d7c4239b0 | async def get_orders(self, return_raw_response: bool=False, offset: typing.Optional[int]=None, count: typing.Optional[int]=None, extended: typing.Optional[BaseBoolInt]=None) -> typing.Union[(dict, MarketGetOrdersResponse, MarketGetOrdersExtendedResponse)]:
'\n :param offset:\n :param count:\n :param extended:\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getOrders', params))
if return_raw_response:
return raw_result
result = (MarketGetOrdersResponse(**raw_result) if (not extended) else MarketGetOrdersExtendedResponse(**raw_result))
return result | :param offset:
:param count:
:param extended:
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | get_orders | amishakov/vkwave | 222 | python | async def get_orders(self, return_raw_response: bool=False, offset: typing.Optional[int]=None, count: typing.Optional[int]=None, extended: typing.Optional[BaseBoolInt]=None) -> typing.Union[(dict, MarketGetOrdersResponse, MarketGetOrdersExtendedResponse)]:
'\n :param offset:\n :param count:\n :param extended:\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getOrders', params))
if return_raw_response:
return raw_result
result = (MarketGetOrdersResponse(**raw_result) if (not extended) else MarketGetOrdersExtendedResponse(**raw_result))
return result | async def get_orders(self, return_raw_response: bool=False, offset: typing.Optional[int]=None, count: typing.Optional[int]=None, extended: typing.Optional[BaseBoolInt]=None) -> typing.Union[(dict, MarketGetOrdersResponse, MarketGetOrdersExtendedResponse)]:
'\n :param offset:\n :param count:\n :param extended:\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('getOrders', params))
if return_raw_response:
return raw_result
result = (MarketGetOrdersResponse(**raw_result) if (not extended) else MarketGetOrdersExtendedResponse(**raw_result))
return result<|docstring|>:param offset:
:param count:
:param extended:
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
be1b33e7590885121a0c2d38680366fdc2d60092abc64edf7a1f45067d225443 | async def remove_from_album(self, owner_id: int, item_id: int, album_ids: typing.List[int], return_raw_response: bool=False) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param item_id: - Item ID.\n :param album_ids: - Collections IDs to remove item from.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('removeFromAlbum', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | :param owner_id: - ID of an item owner community.
:param item_id: - Item ID.
:param album_ids: - Collections IDs to remove item from.
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | remove_from_album | amishakov/vkwave | 222 | python | async def remove_from_album(self, owner_id: int, item_id: int, album_ids: typing.List[int], return_raw_response: bool=False) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param item_id: - Item ID.\n :param album_ids: - Collections IDs to remove item from.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('removeFromAlbum', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | async def remove_from_album(self, owner_id: int, item_id: int, album_ids: typing.List[int], return_raw_response: bool=False) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param item_id: - Item ID.\n :param album_ids: - Collections IDs to remove item from.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('removeFromAlbum', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result<|docstring|>:param owner_id: - ID of an item owner community.
:param item_id: - Item ID.
:param album_ids: - Collections IDs to remove item from.
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
967e4145a20052e99a9a585eae658331e2b809ddc2841641beb527319392b363 | async def reorder_albums(self, owner_id: int, album_id: int, return_raw_response: bool=False, before: typing.Optional[int]=None, after: typing.Optional[int]=None) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param album_id: - Collection ID.\n :param before: - ID of a collection to place current collection before it.\n :param after: - ID of a collection to place current collection after it.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('reorderAlbums', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | :param owner_id: - ID of an item owner community.
:param album_id: - Collection ID.
:param before: - ID of a collection to place current collection before it.
:param after: - ID of a collection to place current collection after it.
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | reorder_albums | amishakov/vkwave | 222 | python | async def reorder_albums(self, owner_id: int, album_id: int, return_raw_response: bool=False, before: typing.Optional[int]=None, after: typing.Optional[int]=None) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param album_id: - Collection ID.\n :param before: - ID of a collection to place current collection before it.\n :param after: - ID of a collection to place current collection after it.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('reorderAlbums', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | async def reorder_albums(self, owner_id: int, album_id: int, return_raw_response: bool=False, before: typing.Optional[int]=None, after: typing.Optional[int]=None) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param album_id: - Collection ID.\n :param before: - ID of a collection to place current collection before it.\n :param after: - ID of a collection to place current collection after it.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('reorderAlbums', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result<|docstring|>:param owner_id: - ID of an item owner community.
:param album_id: - Collection ID.
:param before: - ID of a collection to place current collection before it.
:param after: - ID of a collection to place current collection after it.
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
f3299df77c994f5cb187045be2b52cc0189af3b102167921f9ae631ef7808a9a | async def reorder_items(self, owner_id: int, item_id: int, return_raw_response: bool=False, album_id: typing.Optional[int]=None, before: typing.Optional[int]=None, after: typing.Optional[int]=None) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param album_id: - ID of a collection to reorder items in. Set 0 to reorder full items list.\n :param item_id: - Item ID.\n :param before: - ID of an item to place current item before it.\n :param after: - ID of an item to place current item after it.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('reorderItems', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | :param owner_id: - ID of an item owner community.
:param album_id: - ID of a collection to reorder items in. Set 0 to reorder full items list.
:param item_id: - Item ID.
:param before: - ID of an item to place current item before it.
:param after: - ID of an item to place current item after it.
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | reorder_items | amishakov/vkwave | 222 | python | async def reorder_items(self, owner_id: int, item_id: int, return_raw_response: bool=False, album_id: typing.Optional[int]=None, before: typing.Optional[int]=None, after: typing.Optional[int]=None) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param album_id: - ID of a collection to reorder items in. Set 0 to reorder full items list.\n :param item_id: - Item ID.\n :param before: - ID of an item to place current item before it.\n :param after: - ID of an item to place current item after it.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('reorderItems', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | async def reorder_items(self, owner_id: int, item_id: int, return_raw_response: bool=False, album_id: typing.Optional[int]=None, before: typing.Optional[int]=None, after: typing.Optional[int]=None) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param album_id: - ID of a collection to reorder items in. Set 0 to reorder full items list.\n :param item_id: - Item ID.\n :param before: - ID of an item to place current item before it.\n :param after: - ID of an item to place current item after it.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('reorderItems', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result<|docstring|>:param owner_id: - ID of an item owner community.
:param album_id: - ID of a collection to reorder items in. Set 0 to reorder full items list.
:param item_id: - Item ID.
:param before: - ID of an item to place current item before it.
:param after: - ID of an item to place current item after it.
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
14fe679480073d1725d5ed7b4ea51f12cd0466d3d3eb89fd83c6745c60b406ff | async def report(self, owner_id: int, item_id: int, return_raw_response: bool=False, reason: typing.Optional[int]=None) -> typing.Union[(dict, BaseOkResponse)]:
"\n :param owner_id: - ID of an item owner community.\n :param item_id: - Item ID.\n :param reason: - Complaint reason. Possible values: *'0' β spam,, *'1' β child porn,, *'2' β extremism,, *'3' β violence,, *'4' β drugs propaganda,, *'5' β adult materials,, *'6' β insult.\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('report', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | :param owner_id: - ID of an item owner community.
:param item_id: - Item ID.
:param reason: - Complaint reason. Possible values: *'0' β spam,, *'1' β child porn,, *'2' β extremism,, *'3' β violence,, *'4' β drugs propaganda,, *'5' β adult materials,, *'6' β insult.
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | report | amishakov/vkwave | 222 | python | async def report(self, owner_id: int, item_id: int, return_raw_response: bool=False, reason: typing.Optional[int]=None) -> typing.Union[(dict, BaseOkResponse)]:
"\n :param owner_id: - ID of an item owner community.\n :param item_id: - Item ID.\n :param reason: - Complaint reason. Possible values: *'0' β spam,, *'1' β child porn,, *'2' β extremism,, *'3' β violence,, *'4' β drugs propaganda,, *'5' β adult materials,, *'6' β insult.\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('report', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | async def report(self, owner_id: int, item_id: int, return_raw_response: bool=False, reason: typing.Optional[int]=None) -> typing.Union[(dict, BaseOkResponse)]:
"\n :param owner_id: - ID of an item owner community.\n :param item_id: - Item ID.\n :param reason: - Complaint reason. Possible values: *'0' β spam,, *'1' β child porn,, *'2' β extremism,, *'3' β violence,, *'4' β drugs propaganda,, *'5' β adult materials,, *'6' β insult.\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('report', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result<|docstring|>:param owner_id: - ID of an item owner community.
:param item_id: - Item ID.
:param reason: - Complaint reason. Possible values: *'0' β spam,, *'1' β child porn,, *'2' β extremism,, *'3' β violence,, *'4' β drugs propaganda,, *'5' β adult materials,, *'6' β insult.
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
cde31a736c670430fa8bbd665aa8749f95a274632d73e39557029164533100a2 | async def report_comment(self, owner_id: int, comment_id: int, reason: int, return_raw_response: bool=False) -> typing.Union[(dict, BaseOkResponse)]:
"\n :param owner_id: - ID of an item owner community.\n :param comment_id: - Comment ID.\n :param reason: - Complaint reason. Possible values: *'0' β spam,, *'1' β child porn,, *'2' β extremism,, *'3' β violence,, *'4' β drugs propaganda,, *'5' β adult materials,, *'6' β insult.\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('reportComment', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | :param owner_id: - ID of an item owner community.
:param comment_id: - Comment ID.
:param reason: - Complaint reason. Possible values: *'0' β spam,, *'1' β child porn,, *'2' β extremism,, *'3' β violence,, *'4' β drugs propaganda,, *'5' β adult materials,, *'6' β insult.
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | report_comment | amishakov/vkwave | 222 | python | async def report_comment(self, owner_id: int, comment_id: int, reason: int, return_raw_response: bool=False) -> typing.Union[(dict, BaseOkResponse)]:
"\n :param owner_id: - ID of an item owner community.\n :param comment_id: - Comment ID.\n :param reason: - Complaint reason. Possible values: *'0' β spam,, *'1' β child porn,, *'2' β extremism,, *'3' β violence,, *'4' β drugs propaganda,, *'5' β adult materials,, *'6' β insult.\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('reportComment', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | async def report_comment(self, owner_id: int, comment_id: int, reason: int, return_raw_response: bool=False) -> typing.Union[(dict, BaseOkResponse)]:
"\n :param owner_id: - ID of an item owner community.\n :param comment_id: - Comment ID.\n :param reason: - Complaint reason. Possible values: *'0' β spam,, *'1' β child porn,, *'2' β extremism,, *'3' β violence,, *'4' β drugs propaganda,, *'5' β adult materials,, *'6' β insult.\n :param return_raw_response: - return result at dict\n :return:\n "
params = get_params(locals())
raw_result = (await self.api_request('reportComment', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result<|docstring|>:param owner_id: - ID of an item owner community.
:param comment_id: - Comment ID.
:param reason: - Complaint reason. Possible values: *'0' β spam,, *'1' β child porn,, *'2' β extremism,, *'3' β violence,, *'4' β drugs propaganda,, *'5' β adult materials,, *'6' β insult.
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
bf84f7d32c39e9c4526024a701cf83a162af85b90f2313489cf928eef3443c10 | async def restore(self, owner_id: int, item_id: int, return_raw_response: bool=False) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param item_id: - Deleted item ID.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('restore', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | :param owner_id: - ID of an item owner community.
:param item_id: - Deleted item ID.
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | restore | amishakov/vkwave | 222 | python | async def restore(self, owner_id: int, item_id: int, return_raw_response: bool=False) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param item_id: - Deleted item ID.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('restore', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result | async def restore(self, owner_id: int, item_id: int, return_raw_response: bool=False) -> typing.Union[(dict, BaseOkResponse)]:
'\n :param owner_id: - ID of an item owner community.\n :param item_id: - Deleted item ID.\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('restore', params))
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result<|docstring|>:param owner_id: - ID of an item owner community.
:param item_id: - Deleted item ID.
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
1cf633aaf7fe6a792f973ba05c2df5052a01decfcf9b3a0e0eb9b9bcce3846c6 | async def restore_comment(self, owner_id: int, comment_id: int, return_raw_response: bool=False) -> typing.Union[(dict, MarketRestoreCommentResponse)]:
'\n :param owner_id: - identifier of an item owner community, "Note that community id in the \'owner_id\' parameter should be negative number. For example \'owner_id\'=-1 matches the [vk.com/apiclub|VK API] community "\n :param comment_id: - deleted comment id\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('restoreComment', params))
if return_raw_response:
return raw_result
result = MarketRestoreCommentResponse(**raw_result)
return result | :param owner_id: - identifier of an item owner community, "Note that community id in the 'owner_id' parameter should be negative number. For example 'owner_id'=-1 matches the [vk.com/apiclub|VK API] community "
:param comment_id: - deleted comment id
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | restore_comment | amishakov/vkwave | 222 | python | async def restore_comment(self, owner_id: int, comment_id: int, return_raw_response: bool=False) -> typing.Union[(dict, MarketRestoreCommentResponse)]:
'\n :param owner_id: - identifier of an item owner community, "Note that community id in the \'owner_id\' parameter should be negative number. For example \'owner_id\'=-1 matches the [vk.com/apiclub|VK API] community "\n :param comment_id: - deleted comment id\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('restoreComment', params))
if return_raw_response:
return raw_result
result = MarketRestoreCommentResponse(**raw_result)
return result | async def restore_comment(self, owner_id: int, comment_id: int, return_raw_response: bool=False) -> typing.Union[(dict, MarketRestoreCommentResponse)]:
'\n :param owner_id: - identifier of an item owner community, "Note that community id in the \'owner_id\' parameter should be negative number. For example \'owner_id\'=-1 matches the [vk.com/apiclub|VK API] community "\n :param comment_id: - deleted comment id\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('restoreComment', params))
if return_raw_response:
return raw_result
result = MarketRestoreCommentResponse(**raw_result)
return result<|docstring|>:param owner_id: - identifier of an item owner community, "Note that community id in the 'owner_id' parameter should be negative number. For example 'owner_id'=-1 matches the [vk.com/apiclub|VK API] community "
:param comment_id: - deleted comment id
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
10e8d9d9a7caa7b2149fd3b115e7e2092957f76b615f7bbf4dd6a520113bd2f6 | async def search(self, owner_id: int, return_raw_response: bool=False, album_id: typing.Optional[int]=None, q: typing.Optional[str]=None, price_from: typing.Optional[int]=None, price_to: typing.Optional[int]=None, sort: typing.Optional[int]=None, rev: typing.Optional[int]=None, offset: typing.Optional[int]=None, count: typing.Optional[int]=None, extended: typing.Optional[BaseBoolInt]=None, status: typing.Optional[int]=None) -> typing.Union[(dict, MarketSearchResponse, MarketSearchExtendedResponse)]:
'\n :param owner_id: - ID of an items owner community.\n :param album_id:\n :param q: - Search query, for example "pink slippers".\n :param price_from: - Minimum item price value.\n :param price_to: - Maximum item price value.\n :param sort:\n :param rev: - \'0\' β do not use reverse order, \'1\' β use reverse order\n :param offset: - Offset needed to return a specific subset of results.\n :param count: - Number of items to return.\n :param extended: - \'1\' β to return additional fields: \'likes, can_comment, car_repost, photos\'. By default: \'0\'.\n :param status:\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('search', params))
if return_raw_response:
return raw_result
result = (MarketSearchResponse(**raw_result) if (not extended) else MarketSearchExtendedResponse(**raw_result))
return result | :param owner_id: - ID of an items owner community.
:param album_id:
:param q: - Search query, for example "pink slippers".
:param price_from: - Minimum item price value.
:param price_to: - Maximum item price value.
:param sort:
:param rev: - '0' β do not use reverse order, '1' β use reverse order
:param offset: - Offset needed to return a specific subset of results.
:param count: - Number of items to return.
:param extended: - '1' β to return additional fields: 'likes, can_comment, car_repost, photos'. By default: '0'.
:param status:
:param return_raw_response: - return result at dict
:return: | vkwave/api/methods/market.py | search | amishakov/vkwave | 222 | python | async def search(self, owner_id: int, return_raw_response: bool=False, album_id: typing.Optional[int]=None, q: typing.Optional[str]=None, price_from: typing.Optional[int]=None, price_to: typing.Optional[int]=None, sort: typing.Optional[int]=None, rev: typing.Optional[int]=None, offset: typing.Optional[int]=None, count: typing.Optional[int]=None, extended: typing.Optional[BaseBoolInt]=None, status: typing.Optional[int]=None) -> typing.Union[(dict, MarketSearchResponse, MarketSearchExtendedResponse)]:
'\n :param owner_id: - ID of an items owner community.\n :param album_id:\n :param q: - Search query, for example "pink slippers".\n :param price_from: - Minimum item price value.\n :param price_to: - Maximum item price value.\n :param sort:\n :param rev: - \'0\' β do not use reverse order, \'1\' β use reverse order\n :param offset: - Offset needed to return a specific subset of results.\n :param count: - Number of items to return.\n :param extended: - \'1\' β to return additional fields: \'likes, can_comment, car_repost, photos\'. By default: \'0\'.\n :param status:\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('search', params))
if return_raw_response:
return raw_result
result = (MarketSearchResponse(**raw_result) if (not extended) else MarketSearchExtendedResponse(**raw_result))
return result | async def search(self, owner_id: int, return_raw_response: bool=False, album_id: typing.Optional[int]=None, q: typing.Optional[str]=None, price_from: typing.Optional[int]=None, price_to: typing.Optional[int]=None, sort: typing.Optional[int]=None, rev: typing.Optional[int]=None, offset: typing.Optional[int]=None, count: typing.Optional[int]=None, extended: typing.Optional[BaseBoolInt]=None, status: typing.Optional[int]=None) -> typing.Union[(dict, MarketSearchResponse, MarketSearchExtendedResponse)]:
'\n :param owner_id: - ID of an items owner community.\n :param album_id:\n :param q: - Search query, for example "pink slippers".\n :param price_from: - Minimum item price value.\n :param price_to: - Maximum item price value.\n :param sort:\n :param rev: - \'0\' β do not use reverse order, \'1\' β use reverse order\n :param offset: - Offset needed to return a specific subset of results.\n :param count: - Number of items to return.\n :param extended: - \'1\' β to return additional fields: \'likes, can_comment, car_repost, photos\'. By default: \'0\'.\n :param status:\n :param return_raw_response: - return result at dict\n :return:\n '
params = get_params(locals())
raw_result = (await self.api_request('search', params))
if return_raw_response:
return raw_result
result = (MarketSearchResponse(**raw_result) if (not extended) else MarketSearchExtendedResponse(**raw_result))
return result<|docstring|>:param owner_id: - ID of an items owner community.
:param album_id:
:param q: - Search query, for example "pink slippers".
:param price_from: - Minimum item price value.
:param price_to: - Maximum item price value.
:param sort:
:param rev: - '0' β do not use reverse order, '1' β use reverse order
:param offset: - Offset needed to return a specific subset of results.
:param count: - Number of items to return.
:param extended: - '1' β to return additional fields: 'likes, can_comment, car_repost, photos'. By default: '0'.
:param status:
:param return_raw_response: - return result at dict
:return:<|endoftext|> |
8458430fa2cf260fba3e6e42f312718fca346b812f85c43a60982f1a85e84acc | def main(argv=None):
' Run this program '
if (argv is None):
argv = sys.argv
args = parse_args(argv)
params = slugify_params(args)
try:
print(slugify(**params))
except KeyboardInterrupt:
sys.exit((- 1)) | Run this program | flask/nbaage/lib/python3.9/site-packages/slugify/__main__.py | main | michaelmarzec/NBA-Age-Analysis | 1,109 | python | def main(argv=None):
' '
if (argv is None):
argv = sys.argv
args = parse_args(argv)
params = slugify_params(args)
try:
print(slugify(**params))
except KeyboardInterrupt:
sys.exit((- 1)) | def main(argv=None):
' '
if (argv is None):
argv = sys.argv
args = parse_args(argv)
params = slugify_params(args)
try:
print(slugify(**params))
except KeyboardInterrupt:
sys.exit((- 1))<|docstring|>Run this program<|endoftext|> |
9048fa72b922ba7c212290eaec20ffd9e8c2e702af5409c004960a80c873bdaf | def run_train(data, train_specific, train_params, data_specific, train_history, train_history_path):
'\n Run training with the given data, parameters and hyperparameters\n :param data: dict, data\n :param train_specific: dict, train hyper-parameters\n :param train_params: dict, train parameters\n :param data_specific: dict, data-specific parameters\n :param train_history: dict, train history\n :param train_history_path: str, path to train history\n :return: None, prints the training outputs\n '
seed = train_specific['seed']
learning_rate = train_specific['learning_rate']
embedding_dim = train_specific['embedding_dim']
use_batch_norm = train_specific['use_batch_norm']
l2_reg_weight = train_specific['l2_reg_weight']
num_epochs = train_specific['num_epochs']
batch_size = train_specific['batch_size']
train_dropout_keep_rate = train_specific['dropout']
learning_rate_multiplier = train_specific['learning_rate_multiplier']
cache_dir = train_specific['cache_dir']
train_path = train_specific['train_path']
del train_specific['train_path']
train_description_hashes = data['train_description_hashes']
train_labels = data['train_labels']
test_description_hashes = data['test_description_hashes']
test_labels = data['test_labels']
label_vocab = data['label_vocab']
cache = data['cache']
num_words_in_train = data['num_words_in_train']
test_path = data['test_path']
initial_test_len = data['initial_test_len']
num_labels = len(label_vocab)
use_gpu = train_params['use_gpu']
gpu_fraction = train_params['gpu_fraction']
use_tensorboard = train_params['use_tensorboard']
top_k = train_params['top_k']
save_all_models = train_params['save_all_models']
compare_top_k = train_params['compare_top_k']
use_test = train_params['use_test']
log_dir = train_params['log_dir']
batch_size_inference = train_params['batch_size_inference']
progress_bar = train_params['progress_bar']
flush = train_params['flush']
hyperparameter_hash = hash_(''.join([str(hyperparam) for hyperparam in train_specific.values()]))
if use_gpu:
device = '/gpu:0'
config = tf.ConfigProto(allow_soft_placement=True, gpu_options=tf.GPUOptions(per_process_gpu_memory_fraction=gpu_fraction, allow_growth=True))
else:
device = '/cpu:0'
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
config = tf.ConfigProto(allow_soft_placement=True)
with tf.device(device):
with tf.Session(config=config) as sess:
input_placholder = tf.placeholder(tf.int32, shape=[None, None], name='input')
weights_placeholder = tf.placeholder(tf.float32, shape=[None, None], name='input_weights')
labels_placeholder = tf.placeholder(tf.int32, shape=[None], name='label')
learning_rate_placeholder = tf.placeholder_with_default(learning_rate, shape=[], name='learning_rate')
dropout_drop_rate_placeholder = tf.placeholder_with_default(0.0, shape=[], name='dropout_rate')
is_training = tf.placeholder_with_default(False, shape=[], name='do_dropout')
tf.set_random_seed(seed)
with tf.name_scope('embeddings'):
token_embeddings = tf.Variable(tf.random.uniform([num_words_in_train, embedding_dim]), name='embedding_matrix')
with tf.name_scope('mean_sentence_embedding'):
gathered_embeddings = tf.gather(token_embeddings, input_placholder)
weights_broadcasted = tf.expand_dims(weights_placeholder, axis=2)
mean_embedding = tf.reduce_sum(tf.multiply(weights_broadcasted, gathered_embeddings), axis=1, name='sentence_embedding')
if use_batch_norm:
mean_embedding = tf.layers.batch_normalization(mean_embedding, training=is_training)
mean_embedding_dropout = tf.layers.dropout(mean_embedding, rate=dropout_drop_rate_placeholder, training=is_training)
logits = tf.layers.dense(mean_embedding_dropout, num_labels, use_bias=False, kernel_initializer=tf.truncated_normal_initializer(), name='logits')
output = tf.nn.softmax(logits, name='prediction')
with tf.name_scope('Accuracy'):
correctly_predicted = tf.nn.in_top_k(logits, labels_placeholder, 1, name='Top_1')
correctly_predicted_top_k = tf.nn.in_top_k(logits, labels_placeholder, top_k, name='Top_k')
if use_tensorboard:
train_writer = tf.summary.FileWriter(os.path.join(log_dir, 'Train'), sess.graph)
train_end_writer = tf.summary.FileWriter(os.path.join(log_dir, 'End_epoch_train'))
if use_test:
batch_counter = 0
if use_tensorboard:
test_writer = tf.summary.FileWriter(os.path.join(log_dir, 'Test'))
test_end_writer = tf.summary.FileWriter(os.path.join(log_dir, 'End_epoch_test'))
ce_loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(labels=labels_placeholder, logits=logits), name='CE_loss')
l2_vars = tf.trainable_variables()
l2_loss = tf.multiply(tf.add_n([tf.nn.l2_loss(v) for v in l2_vars]), l2_reg_weight, name='L2_loss')
total_loss = tf.add(ce_loss, l2_loss, name='Total_loss')
if use_tensorboard:
tf.summary.scalar('Cross_entropy_loss', ce_loss)
summary_op = tf.summary.merge_all()
else:
summary_op = tf.constant(0)
update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS)
with tf.control_dependencies(update_ops):
train_op = tf.train.AdamOptimizer(learning_rate_placeholder).minimize(total_loss)
sess.run(tf.global_variables_initializer())
iteration = 0
train_start = time.time()
(best_score, best_scores) = ((- 1), {1: None, top_k: None})
logs = {1: [], top_k: [], 'best': (- 1)}
for epoch in range(1, (num_epochs + 1)):
start_iteration = iteration
print('\n\nEpoch {}'.format(epoch), flush=flush)
(end_epoch_accuracy, end_epoch_accuracy_k, end_epoch_loss, end_epoch_l2_loss, losses) = ([], [], [], [], [])
for (batch, batch_weights, batch_labels) in batch_generator(train_description_hashes, train_labels, batch_size, label_vocab, cache, shuffle=True, show_progress=progress_bar, progress_desc='Fit train'):
(_, train_summary, _loss, correct, correct_k, batch_loss, batch_l2) = sess.run([train_op, summary_op, total_loss, correctly_predicted, correctly_predicted_top_k, ce_loss, l2_loss], feed_dict={input_placholder: batch, weights_placeholder: batch_weights, labels_placeholder: batch_labels, learning_rate_placeholder: learning_rate, dropout_drop_rate_placeholder: (1 - train_dropout_keep_rate), is_training: True})
if use_tensorboard:
train_writer.add_summary(train_summary, iteration)
losses.append(_loss)
end_epoch_accuracy.extend(correct)
end_epoch_accuracy_k.extend(correct_k)
end_epoch_loss.append(batch_loss)
end_epoch_l2_loss.append(batch_l2)
iteration += 1
end_iteration = iteration
print('Current learning rate: {}'.format(round(learning_rate, 7)), flush=flush)
learning_rate *= learning_rate_multiplier
mean_loss = percent_array(losses)
if np.isnan(mean_loss):
print('Loss is NaN. Try using smaller learning rate')
exit()
print('Moving mean loss: {}'.format(mean_loss), flush=flush)
mean_accuracy = percent_array(end_epoch_accuracy)
mean_accuracy_k = percent_array(end_epoch_accuracy_k)
if use_tensorboard:
write_summaries(end_epoch_loss, mean_accuracy, mean_accuracy_k, top_k, train_end_writer, epoch)
summary_loss_l2 = tf.Summary(value=[tf.Summary.Value(tag='L2', simple_value=np.mean(end_epoch_l2_loss))])
train_end_writer.add_summary(summary_loss_l2, epoch)
print('Train moving accuracy: {}, top {}: {}'.format(mean_accuracy, top_k, mean_accuracy_k), flush=flush)
if use_test:
num_test_iterations = int(np.ceil((len(test_labels) / batch_size_inference)))
test_iterations = np.linspace(start_iteration, end_iteration, num_test_iterations)
(end_epoch_accuracy, end_epoch_accuracy_k, end_epoch_loss) = ([], [], [])
for (index, (batch, batch_weights, batch_labels)) in enumerate(batch_generator(test_description_hashes, test_labels, batch_size_inference, label_vocab, cache, show_progress=progress_bar, progress_desc='Test')):
(correct, correct_k, batch_loss, test_summary) = sess.run([correctly_predicted, correctly_predicted_top_k, ce_loss, summary_op], feed_dict={input_placholder: batch, weights_placeholder: batch_weights, labels_placeholder: batch_labels})
if use_tensorboard:
test_writer.add_summary(test_summary, int(test_iterations[index]))
end_epoch_accuracy.extend(correct)
end_epoch_accuracy_k.extend(correct_k)
end_epoch_loss.append(batch_loss)
batch_counter += 1
mean_accuracy = np.round(((100 * np.sum(end_epoch_accuracy)) / initial_test_len), 2)
mean_accuracy_k = np.round(((100 * np.sum(end_epoch_accuracy_k)) / initial_test_len), 2)
if use_tensorboard:
write_summaries(end_epoch_loss, mean_accuracy, mean_accuracy_k, top_k, test_end_writer, epoch)
print('Test accuracy: {}, top {}: {}'.format(mean_accuracy, top_k, mean_accuracy_k), flush=flush)
logs[1].append(mean_accuracy)
logs[top_k].append(mean_accuracy_k)
comparable = mean_accuracy
if compare_top_k:
comparable = mean_accuracy_k
if (comparable > best_score):
best_score = comparable
best_scores[1] = mean_accuracy
best_scores[top_k] = mean_accuracy_k
freeze_save_graph(sess, log_dir, 'model_best.pb', 'prediction')
logs['best'] = epoch
if save_all_models:
freeze_save_graph(sess, log_dir, 'model_ep{}.pb'.format(epoch), 'prediction')
elif (epoch == num_epochs):
freeze_save_graph(sess, log_dir, 'model_ep{}.pb'.format(epoch), 'prediction')
iteration += 1
print('Best model mean test accuracy: {}, top {}: {}'.format(logs[1][(logs['best'] - 1)], top_k, logs[top_k][(logs['best'] - 1)]), flush=flush)
print('The model is stored at {}'.format(log_dir), flush=flush)
if use_test:
results = {'hyperparams': train_specific, 'scores': {test_path: best_scores}}
else:
results = {'hyperparams': train_specific, 'scores': {train_path: best_scores}}
train_history[hyperparameter_hash] = results
with open(os.path.join(log_dir, 'results.json'), 'w+') as outfile:
json.dump(results, outfile)
with open(os.path.join(cache_dir, 'details.json'), 'w+') as outfile:
json.dump(data_specific, outfile)
with open(train_history_path, 'w+') as outfile:
json.dump(train_history, outfile)
with open(os.path.join(log_dir, 'accuracy_logs.json'), 'w+') as outfile:
json.dump(logs, outfile)
print('The training took {} seconds'.format(round((time.time() - train_start), 0)), flush=flush)
print('Peak memory usage: {}'.format(round((tracemalloc.get_traced_memory()[1] / 1000000.0), 0)), flush=flush) | Run training with the given data, parameters and hyperparameters
:param data: dict, data
:param train_specific: dict, train hyper-parameters
:param train_params: dict, train parameters
:param data_specific: dict, data-specific parameters
:param train_history: dict, train history
:param train_history_path: str, path to train history
:return: None, prints the training outputs | train.py | run_train | webbfontaine/fasttext-tensorflow | 1 | python | def run_train(data, train_specific, train_params, data_specific, train_history, train_history_path):
'\n Run training with the given data, parameters and hyperparameters\n :param data: dict, data\n :param train_specific: dict, train hyper-parameters\n :param train_params: dict, train parameters\n :param data_specific: dict, data-specific parameters\n :param train_history: dict, train history\n :param train_history_path: str, path to train history\n :return: None, prints the training outputs\n '
seed = train_specific['seed']
learning_rate = train_specific['learning_rate']
embedding_dim = train_specific['embedding_dim']
use_batch_norm = train_specific['use_batch_norm']
l2_reg_weight = train_specific['l2_reg_weight']
num_epochs = train_specific['num_epochs']
batch_size = train_specific['batch_size']
train_dropout_keep_rate = train_specific['dropout']
learning_rate_multiplier = train_specific['learning_rate_multiplier']
cache_dir = train_specific['cache_dir']
train_path = train_specific['train_path']
del train_specific['train_path']
train_description_hashes = data['train_description_hashes']
train_labels = data['train_labels']
test_description_hashes = data['test_description_hashes']
test_labels = data['test_labels']
label_vocab = data['label_vocab']
cache = data['cache']
num_words_in_train = data['num_words_in_train']
test_path = data['test_path']
initial_test_len = data['initial_test_len']
num_labels = len(label_vocab)
use_gpu = train_params['use_gpu']
gpu_fraction = train_params['gpu_fraction']
use_tensorboard = train_params['use_tensorboard']
top_k = train_params['top_k']
save_all_models = train_params['save_all_models']
compare_top_k = train_params['compare_top_k']
use_test = train_params['use_test']
log_dir = train_params['log_dir']
batch_size_inference = train_params['batch_size_inference']
progress_bar = train_params['progress_bar']
flush = train_params['flush']
hyperparameter_hash = hash_(.join([str(hyperparam) for hyperparam in train_specific.values()]))
if use_gpu:
device = '/gpu:0'
config = tf.ConfigProto(allow_soft_placement=True, gpu_options=tf.GPUOptions(per_process_gpu_memory_fraction=gpu_fraction, allow_growth=True))
else:
device = '/cpu:0'
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
config = tf.ConfigProto(allow_soft_placement=True)
with tf.device(device):
with tf.Session(config=config) as sess:
input_placholder = tf.placeholder(tf.int32, shape=[None, None], name='input')
weights_placeholder = tf.placeholder(tf.float32, shape=[None, None], name='input_weights')
labels_placeholder = tf.placeholder(tf.int32, shape=[None], name='label')
learning_rate_placeholder = tf.placeholder_with_default(learning_rate, shape=[], name='learning_rate')
dropout_drop_rate_placeholder = tf.placeholder_with_default(0.0, shape=[], name='dropout_rate')
is_training = tf.placeholder_with_default(False, shape=[], name='do_dropout')
tf.set_random_seed(seed)
with tf.name_scope('embeddings'):
token_embeddings = tf.Variable(tf.random.uniform([num_words_in_train, embedding_dim]), name='embedding_matrix')
with tf.name_scope('mean_sentence_embedding'):
gathered_embeddings = tf.gather(token_embeddings, input_placholder)
weights_broadcasted = tf.expand_dims(weights_placeholder, axis=2)
mean_embedding = tf.reduce_sum(tf.multiply(weights_broadcasted, gathered_embeddings), axis=1, name='sentence_embedding')
if use_batch_norm:
mean_embedding = tf.layers.batch_normalization(mean_embedding, training=is_training)
mean_embedding_dropout = tf.layers.dropout(mean_embedding, rate=dropout_drop_rate_placeholder, training=is_training)
logits = tf.layers.dense(mean_embedding_dropout, num_labels, use_bias=False, kernel_initializer=tf.truncated_normal_initializer(), name='logits')
output = tf.nn.softmax(logits, name='prediction')
with tf.name_scope('Accuracy'):
correctly_predicted = tf.nn.in_top_k(logits, labels_placeholder, 1, name='Top_1')
correctly_predicted_top_k = tf.nn.in_top_k(logits, labels_placeholder, top_k, name='Top_k')
if use_tensorboard:
train_writer = tf.summary.FileWriter(os.path.join(log_dir, 'Train'), sess.graph)
train_end_writer = tf.summary.FileWriter(os.path.join(log_dir, 'End_epoch_train'))
if use_test:
batch_counter = 0
if use_tensorboard:
test_writer = tf.summary.FileWriter(os.path.join(log_dir, 'Test'))
test_end_writer = tf.summary.FileWriter(os.path.join(log_dir, 'End_epoch_test'))
ce_loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(labels=labels_placeholder, logits=logits), name='CE_loss')
l2_vars = tf.trainable_variables()
l2_loss = tf.multiply(tf.add_n([tf.nn.l2_loss(v) for v in l2_vars]), l2_reg_weight, name='L2_loss')
total_loss = tf.add(ce_loss, l2_loss, name='Total_loss')
if use_tensorboard:
tf.summary.scalar('Cross_entropy_loss', ce_loss)
summary_op = tf.summary.merge_all()
else:
summary_op = tf.constant(0)
update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS)
with tf.control_dependencies(update_ops):
train_op = tf.train.AdamOptimizer(learning_rate_placeholder).minimize(total_loss)
sess.run(tf.global_variables_initializer())
iteration = 0
train_start = time.time()
(best_score, best_scores) = ((- 1), {1: None, top_k: None})
logs = {1: [], top_k: [], 'best': (- 1)}
for epoch in range(1, (num_epochs + 1)):
start_iteration = iteration
print('\n\nEpoch {}'.format(epoch), flush=flush)
(end_epoch_accuracy, end_epoch_accuracy_k, end_epoch_loss, end_epoch_l2_loss, losses) = ([], [], [], [], [])
for (batch, batch_weights, batch_labels) in batch_generator(train_description_hashes, train_labels, batch_size, label_vocab, cache, shuffle=True, show_progress=progress_bar, progress_desc='Fit train'):
(_, train_summary, _loss, correct, correct_k, batch_loss, batch_l2) = sess.run([train_op, summary_op, total_loss, correctly_predicted, correctly_predicted_top_k, ce_loss, l2_loss], feed_dict={input_placholder: batch, weights_placeholder: batch_weights, labels_placeholder: batch_labels, learning_rate_placeholder: learning_rate, dropout_drop_rate_placeholder: (1 - train_dropout_keep_rate), is_training: True})
if use_tensorboard:
train_writer.add_summary(train_summary, iteration)
losses.append(_loss)
end_epoch_accuracy.extend(correct)
end_epoch_accuracy_k.extend(correct_k)
end_epoch_loss.append(batch_loss)
end_epoch_l2_loss.append(batch_l2)
iteration += 1
end_iteration = iteration
print('Current learning rate: {}'.format(round(learning_rate, 7)), flush=flush)
learning_rate *= learning_rate_multiplier
mean_loss = percent_array(losses)
if np.isnan(mean_loss):
print('Loss is NaN. Try using smaller learning rate')
exit()
print('Moving mean loss: {}'.format(mean_loss), flush=flush)
mean_accuracy = percent_array(end_epoch_accuracy)
mean_accuracy_k = percent_array(end_epoch_accuracy_k)
if use_tensorboard:
write_summaries(end_epoch_loss, mean_accuracy, mean_accuracy_k, top_k, train_end_writer, epoch)
summary_loss_l2 = tf.Summary(value=[tf.Summary.Value(tag='L2', simple_value=np.mean(end_epoch_l2_loss))])
train_end_writer.add_summary(summary_loss_l2, epoch)
print('Train moving accuracy: {}, top {}: {}'.format(mean_accuracy, top_k, mean_accuracy_k), flush=flush)
if use_test:
num_test_iterations = int(np.ceil((len(test_labels) / batch_size_inference)))
test_iterations = np.linspace(start_iteration, end_iteration, num_test_iterations)
(end_epoch_accuracy, end_epoch_accuracy_k, end_epoch_loss) = ([], [], [])
for (index, (batch, batch_weights, batch_labels)) in enumerate(batch_generator(test_description_hashes, test_labels, batch_size_inference, label_vocab, cache, show_progress=progress_bar, progress_desc='Test')):
(correct, correct_k, batch_loss, test_summary) = sess.run([correctly_predicted, correctly_predicted_top_k, ce_loss, summary_op], feed_dict={input_placholder: batch, weights_placeholder: batch_weights, labels_placeholder: batch_labels})
if use_tensorboard:
test_writer.add_summary(test_summary, int(test_iterations[index]))
end_epoch_accuracy.extend(correct)
end_epoch_accuracy_k.extend(correct_k)
end_epoch_loss.append(batch_loss)
batch_counter += 1
mean_accuracy = np.round(((100 * np.sum(end_epoch_accuracy)) / initial_test_len), 2)
mean_accuracy_k = np.round(((100 * np.sum(end_epoch_accuracy_k)) / initial_test_len), 2)
if use_tensorboard:
write_summaries(end_epoch_loss, mean_accuracy, mean_accuracy_k, top_k, test_end_writer, epoch)
print('Test accuracy: {}, top {}: {}'.format(mean_accuracy, top_k, mean_accuracy_k), flush=flush)
logs[1].append(mean_accuracy)
logs[top_k].append(mean_accuracy_k)
comparable = mean_accuracy
if compare_top_k:
comparable = mean_accuracy_k
if (comparable > best_score):
best_score = comparable
best_scores[1] = mean_accuracy
best_scores[top_k] = mean_accuracy_k
freeze_save_graph(sess, log_dir, 'model_best.pb', 'prediction')
logs['best'] = epoch
if save_all_models:
freeze_save_graph(sess, log_dir, 'model_ep{}.pb'.format(epoch), 'prediction')
elif (epoch == num_epochs):
freeze_save_graph(sess, log_dir, 'model_ep{}.pb'.format(epoch), 'prediction')
iteration += 1
print('Best model mean test accuracy: {}, top {}: {}'.format(logs[1][(logs['best'] - 1)], top_k, logs[top_k][(logs['best'] - 1)]), flush=flush)
print('The model is stored at {}'.format(log_dir), flush=flush)
if use_test:
results = {'hyperparams': train_specific, 'scores': {test_path: best_scores}}
else:
results = {'hyperparams': train_specific, 'scores': {train_path: best_scores}}
train_history[hyperparameter_hash] = results
with open(os.path.join(log_dir, 'results.json'), 'w+') as outfile:
json.dump(results, outfile)
with open(os.path.join(cache_dir, 'details.json'), 'w+') as outfile:
json.dump(data_specific, outfile)
with open(train_history_path, 'w+') as outfile:
json.dump(train_history, outfile)
with open(os.path.join(log_dir, 'accuracy_logs.json'), 'w+') as outfile:
json.dump(logs, outfile)
print('The training took {} seconds'.format(round((time.time() - train_start), 0)), flush=flush)
print('Peak memory usage: {}'.format(round((tracemalloc.get_traced_memory()[1] / 1000000.0), 0)), flush=flush) | def run_train(data, train_specific, train_params, data_specific, train_history, train_history_path):
'\n Run training with the given data, parameters and hyperparameters\n :param data: dict, data\n :param train_specific: dict, train hyper-parameters\n :param train_params: dict, train parameters\n :param data_specific: dict, data-specific parameters\n :param train_history: dict, train history\n :param train_history_path: str, path to train history\n :return: None, prints the training outputs\n '
seed = train_specific['seed']
learning_rate = train_specific['learning_rate']
embedding_dim = train_specific['embedding_dim']
use_batch_norm = train_specific['use_batch_norm']
l2_reg_weight = train_specific['l2_reg_weight']
num_epochs = train_specific['num_epochs']
batch_size = train_specific['batch_size']
train_dropout_keep_rate = train_specific['dropout']
learning_rate_multiplier = train_specific['learning_rate_multiplier']
cache_dir = train_specific['cache_dir']
train_path = train_specific['train_path']
del train_specific['train_path']
train_description_hashes = data['train_description_hashes']
train_labels = data['train_labels']
test_description_hashes = data['test_description_hashes']
test_labels = data['test_labels']
label_vocab = data['label_vocab']
cache = data['cache']
num_words_in_train = data['num_words_in_train']
test_path = data['test_path']
initial_test_len = data['initial_test_len']
num_labels = len(label_vocab)
use_gpu = train_params['use_gpu']
gpu_fraction = train_params['gpu_fraction']
use_tensorboard = train_params['use_tensorboard']
top_k = train_params['top_k']
save_all_models = train_params['save_all_models']
compare_top_k = train_params['compare_top_k']
use_test = train_params['use_test']
log_dir = train_params['log_dir']
batch_size_inference = train_params['batch_size_inference']
progress_bar = train_params['progress_bar']
flush = train_params['flush']
hyperparameter_hash = hash_(.join([str(hyperparam) for hyperparam in train_specific.values()]))
if use_gpu:
device = '/gpu:0'
config = tf.ConfigProto(allow_soft_placement=True, gpu_options=tf.GPUOptions(per_process_gpu_memory_fraction=gpu_fraction, allow_growth=True))
else:
device = '/cpu:0'
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
config = tf.ConfigProto(allow_soft_placement=True)
with tf.device(device):
with tf.Session(config=config) as sess:
input_placholder = tf.placeholder(tf.int32, shape=[None, None], name='input')
weights_placeholder = tf.placeholder(tf.float32, shape=[None, None], name='input_weights')
labels_placeholder = tf.placeholder(tf.int32, shape=[None], name='label')
learning_rate_placeholder = tf.placeholder_with_default(learning_rate, shape=[], name='learning_rate')
dropout_drop_rate_placeholder = tf.placeholder_with_default(0.0, shape=[], name='dropout_rate')
is_training = tf.placeholder_with_default(False, shape=[], name='do_dropout')
tf.set_random_seed(seed)
with tf.name_scope('embeddings'):
token_embeddings = tf.Variable(tf.random.uniform([num_words_in_train, embedding_dim]), name='embedding_matrix')
with tf.name_scope('mean_sentence_embedding'):
gathered_embeddings = tf.gather(token_embeddings, input_placholder)
weights_broadcasted = tf.expand_dims(weights_placeholder, axis=2)
mean_embedding = tf.reduce_sum(tf.multiply(weights_broadcasted, gathered_embeddings), axis=1, name='sentence_embedding')
if use_batch_norm:
mean_embedding = tf.layers.batch_normalization(mean_embedding, training=is_training)
mean_embedding_dropout = tf.layers.dropout(mean_embedding, rate=dropout_drop_rate_placeholder, training=is_training)
logits = tf.layers.dense(mean_embedding_dropout, num_labels, use_bias=False, kernel_initializer=tf.truncated_normal_initializer(), name='logits')
output = tf.nn.softmax(logits, name='prediction')
with tf.name_scope('Accuracy'):
correctly_predicted = tf.nn.in_top_k(logits, labels_placeholder, 1, name='Top_1')
correctly_predicted_top_k = tf.nn.in_top_k(logits, labels_placeholder, top_k, name='Top_k')
if use_tensorboard:
train_writer = tf.summary.FileWriter(os.path.join(log_dir, 'Train'), sess.graph)
train_end_writer = tf.summary.FileWriter(os.path.join(log_dir, 'End_epoch_train'))
if use_test:
batch_counter = 0
if use_tensorboard:
test_writer = tf.summary.FileWriter(os.path.join(log_dir, 'Test'))
test_end_writer = tf.summary.FileWriter(os.path.join(log_dir, 'End_epoch_test'))
ce_loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(labels=labels_placeholder, logits=logits), name='CE_loss')
l2_vars = tf.trainable_variables()
l2_loss = tf.multiply(tf.add_n([tf.nn.l2_loss(v) for v in l2_vars]), l2_reg_weight, name='L2_loss')
total_loss = tf.add(ce_loss, l2_loss, name='Total_loss')
if use_tensorboard:
tf.summary.scalar('Cross_entropy_loss', ce_loss)
summary_op = tf.summary.merge_all()
else:
summary_op = tf.constant(0)
update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS)
with tf.control_dependencies(update_ops):
train_op = tf.train.AdamOptimizer(learning_rate_placeholder).minimize(total_loss)
sess.run(tf.global_variables_initializer())
iteration = 0
train_start = time.time()
(best_score, best_scores) = ((- 1), {1: None, top_k: None})
logs = {1: [], top_k: [], 'best': (- 1)}
for epoch in range(1, (num_epochs + 1)):
start_iteration = iteration
print('\n\nEpoch {}'.format(epoch), flush=flush)
(end_epoch_accuracy, end_epoch_accuracy_k, end_epoch_loss, end_epoch_l2_loss, losses) = ([], [], [], [], [])
for (batch, batch_weights, batch_labels) in batch_generator(train_description_hashes, train_labels, batch_size, label_vocab, cache, shuffle=True, show_progress=progress_bar, progress_desc='Fit train'):
(_, train_summary, _loss, correct, correct_k, batch_loss, batch_l2) = sess.run([train_op, summary_op, total_loss, correctly_predicted, correctly_predicted_top_k, ce_loss, l2_loss], feed_dict={input_placholder: batch, weights_placeholder: batch_weights, labels_placeholder: batch_labels, learning_rate_placeholder: learning_rate, dropout_drop_rate_placeholder: (1 - train_dropout_keep_rate), is_training: True})
if use_tensorboard:
train_writer.add_summary(train_summary, iteration)
losses.append(_loss)
end_epoch_accuracy.extend(correct)
end_epoch_accuracy_k.extend(correct_k)
end_epoch_loss.append(batch_loss)
end_epoch_l2_loss.append(batch_l2)
iteration += 1
end_iteration = iteration
print('Current learning rate: {}'.format(round(learning_rate, 7)), flush=flush)
learning_rate *= learning_rate_multiplier
mean_loss = percent_array(losses)
if np.isnan(mean_loss):
print('Loss is NaN. Try using smaller learning rate')
exit()
print('Moving mean loss: {}'.format(mean_loss), flush=flush)
mean_accuracy = percent_array(end_epoch_accuracy)
mean_accuracy_k = percent_array(end_epoch_accuracy_k)
if use_tensorboard:
write_summaries(end_epoch_loss, mean_accuracy, mean_accuracy_k, top_k, train_end_writer, epoch)
summary_loss_l2 = tf.Summary(value=[tf.Summary.Value(tag='L2', simple_value=np.mean(end_epoch_l2_loss))])
train_end_writer.add_summary(summary_loss_l2, epoch)
print('Train moving accuracy: {}, top {}: {}'.format(mean_accuracy, top_k, mean_accuracy_k), flush=flush)
if use_test:
num_test_iterations = int(np.ceil((len(test_labels) / batch_size_inference)))
test_iterations = np.linspace(start_iteration, end_iteration, num_test_iterations)
(end_epoch_accuracy, end_epoch_accuracy_k, end_epoch_loss) = ([], [], [])
for (index, (batch, batch_weights, batch_labels)) in enumerate(batch_generator(test_description_hashes, test_labels, batch_size_inference, label_vocab, cache, show_progress=progress_bar, progress_desc='Test')):
(correct, correct_k, batch_loss, test_summary) = sess.run([correctly_predicted, correctly_predicted_top_k, ce_loss, summary_op], feed_dict={input_placholder: batch, weights_placeholder: batch_weights, labels_placeholder: batch_labels})
if use_tensorboard:
test_writer.add_summary(test_summary, int(test_iterations[index]))
end_epoch_accuracy.extend(correct)
end_epoch_accuracy_k.extend(correct_k)
end_epoch_loss.append(batch_loss)
batch_counter += 1
mean_accuracy = np.round(((100 * np.sum(end_epoch_accuracy)) / initial_test_len), 2)
mean_accuracy_k = np.round(((100 * np.sum(end_epoch_accuracy_k)) / initial_test_len), 2)
if use_tensorboard:
write_summaries(end_epoch_loss, mean_accuracy, mean_accuracy_k, top_k, test_end_writer, epoch)
print('Test accuracy: {}, top {}: {}'.format(mean_accuracy, top_k, mean_accuracy_k), flush=flush)
logs[1].append(mean_accuracy)
logs[top_k].append(mean_accuracy_k)
comparable = mean_accuracy
if compare_top_k:
comparable = mean_accuracy_k
if (comparable > best_score):
best_score = comparable
best_scores[1] = mean_accuracy
best_scores[top_k] = mean_accuracy_k
freeze_save_graph(sess, log_dir, 'model_best.pb', 'prediction')
logs['best'] = epoch
if save_all_models:
freeze_save_graph(sess, log_dir, 'model_ep{}.pb'.format(epoch), 'prediction')
elif (epoch == num_epochs):
freeze_save_graph(sess, log_dir, 'model_ep{}.pb'.format(epoch), 'prediction')
iteration += 1
print('Best model mean test accuracy: {}, top {}: {}'.format(logs[1][(logs['best'] - 1)], top_k, logs[top_k][(logs['best'] - 1)]), flush=flush)
print('The model is stored at {}'.format(log_dir), flush=flush)
if use_test:
results = {'hyperparams': train_specific, 'scores': {test_path: best_scores}}
else:
results = {'hyperparams': train_specific, 'scores': {train_path: best_scores}}
train_history[hyperparameter_hash] = results
with open(os.path.join(log_dir, 'results.json'), 'w+') as outfile:
json.dump(results, outfile)
with open(os.path.join(cache_dir, 'details.json'), 'w+') as outfile:
json.dump(data_specific, outfile)
with open(train_history_path, 'w+') as outfile:
json.dump(train_history, outfile)
with open(os.path.join(log_dir, 'accuracy_logs.json'), 'w+') as outfile:
json.dump(logs, outfile)
print('The training took {} seconds'.format(round((time.time() - train_start), 0)), flush=flush)
print('Peak memory usage: {}'.format(round((tracemalloc.get_traced_memory()[1] / 1000000.0), 0)), flush=flush)<|docstring|>Run training with the given data, parameters and hyperparameters
:param data: dict, data
:param train_specific: dict, train hyper-parameters
:param train_params: dict, train parameters
:param data_specific: dict, data-specific parameters
:param train_history: dict, train history
:param train_history_path: str, path to train history
:return: None, prints the training outputs<|endoftext|> |
6ee8c519bfcfe6d6d9aaceb9933c97d5c69912adb846340d3b023a30f98bf539 | def get_accuracy(log_dir, train_params, train_history_path, hyperparameter_hash, train_history, test_path, label_prefix='__label__', flush=True):
'\n Use an existing model to measure accuracy on the test file\n :param log_dir: str, path to model directory\n :param train_params: dict, training parameters\n :param train_history_path: str, path train history (json file)\n :param hyperparameter_hash: str, hyperparameter hash kept in training history\n :param train_history: dict, train history\n :param test_path: path to test file\n :param label_prefix: label prefix\n :param flush: flush after printing\n :return: None, prints the accuracy of the trained model on the test file\n '
print('Already trained with those hyper-parameters', flush=flush)
not_done = False
top_k = train_params['top_k']
if (test_path in train_history[hyperparameter_hash]['scores']):
if ((str(top_k) in train_history[hyperparameter_hash]['scores'][test_path]) and (str(1) in train_history[hyperparameter_hash]['scores'][test_path])):
for (k, v) in list(train_history[hyperparameter_hash]['scores'][test_path].items())[::(- 1)]:
print('The accuracy on top {} was {}'.format(k, v), flush=flush)
else:
not_done = True
else:
not_done = True
if not_done:
(test_descriptions, test_labels) = parse_txt(test_path, label_prefix=label_prefix)
model = FastTextModel(model_path=os.path.join(log_dir, 'model_best.pb'), model_params_path=os.path.join(log_dir, 'model_params.json'), label_prefix=label_prefix, use_gpu=train_params['use_gpu'], gpu_fraction=train_params['gpu_fraction'])
(predictions, _) = model.predict(list_of_texts=test_descriptions, k=top_k, batch_size=train_params['batch_size_inference'])
(right_predictions_top_1, right_predictions_top_k) = (0, 0)
for (true_label, predictions_k) in zip(test_labels, predictions):
if (true_label == predictions_k[0]):
right_predictions_top_1 += 1
if (true_label in predictions_k):
right_predictions_top_k += 1
top_1_score = round(((100 * right_predictions_top_1) / len(test_descriptions)), 2)
top_k_score = round(((100 * right_predictions_top_k) / len(test_descriptions)), 2)
print('\nThe accuracy on top {} was {}'.format(1, top_1_score), flush=flush)
print('The accuracy on top {} was {}'.format(top_k, top_k_score), flush=flush)
if (test_path not in train_history[hyperparameter_hash]['scores']):
train_history[hyperparameter_hash]['scores'][test_path] = dict()
train_history[hyperparameter_hash]['scores'][test_path][1] = top_1_score
train_history[hyperparameter_hash]['scores'][test_path][top_k] = top_k_score
with open(train_history_path, 'w+') as outfile:
json.dump(train_history, outfile) | Use an existing model to measure accuracy on the test file
:param log_dir: str, path to model directory
:param train_params: dict, training parameters
:param train_history_path: str, path train history (json file)
:param hyperparameter_hash: str, hyperparameter hash kept in training history
:param train_history: dict, train history
:param test_path: path to test file
:param label_prefix: label prefix
:param flush: flush after printing
:return: None, prints the accuracy of the trained model on the test file | train.py | get_accuracy | webbfontaine/fasttext-tensorflow | 1 | python | def get_accuracy(log_dir, train_params, train_history_path, hyperparameter_hash, train_history, test_path, label_prefix='__label__', flush=True):
'\n Use an existing model to measure accuracy on the test file\n :param log_dir: str, path to model directory\n :param train_params: dict, training parameters\n :param train_history_path: str, path train history (json file)\n :param hyperparameter_hash: str, hyperparameter hash kept in training history\n :param train_history: dict, train history\n :param test_path: path to test file\n :param label_prefix: label prefix\n :param flush: flush after printing\n :return: None, prints the accuracy of the trained model on the test file\n '
print('Already trained with those hyper-parameters', flush=flush)
not_done = False
top_k = train_params['top_k']
if (test_path in train_history[hyperparameter_hash]['scores']):
if ((str(top_k) in train_history[hyperparameter_hash]['scores'][test_path]) and (str(1) in train_history[hyperparameter_hash]['scores'][test_path])):
for (k, v) in list(train_history[hyperparameter_hash]['scores'][test_path].items())[::(- 1)]:
print('The accuracy on top {} was {}'.format(k, v), flush=flush)
else:
not_done = True
else:
not_done = True
if not_done:
(test_descriptions, test_labels) = parse_txt(test_path, label_prefix=label_prefix)
model = FastTextModel(model_path=os.path.join(log_dir, 'model_best.pb'), model_params_path=os.path.join(log_dir, 'model_params.json'), label_prefix=label_prefix, use_gpu=train_params['use_gpu'], gpu_fraction=train_params['gpu_fraction'])
(predictions, _) = model.predict(list_of_texts=test_descriptions, k=top_k, batch_size=train_params['batch_size_inference'])
(right_predictions_top_1, right_predictions_top_k) = (0, 0)
for (true_label, predictions_k) in zip(test_labels, predictions):
if (true_label == predictions_k[0]):
right_predictions_top_1 += 1
if (true_label in predictions_k):
right_predictions_top_k += 1
top_1_score = round(((100 * right_predictions_top_1) / len(test_descriptions)), 2)
top_k_score = round(((100 * right_predictions_top_k) / len(test_descriptions)), 2)
print('\nThe accuracy on top {} was {}'.format(1, top_1_score), flush=flush)
print('The accuracy on top {} was {}'.format(top_k, top_k_score), flush=flush)
if (test_path not in train_history[hyperparameter_hash]['scores']):
train_history[hyperparameter_hash]['scores'][test_path] = dict()
train_history[hyperparameter_hash]['scores'][test_path][1] = top_1_score
train_history[hyperparameter_hash]['scores'][test_path][top_k] = top_k_score
with open(train_history_path, 'w+') as outfile:
json.dump(train_history, outfile) | def get_accuracy(log_dir, train_params, train_history_path, hyperparameter_hash, train_history, test_path, label_prefix='__label__', flush=True):
'\n Use an existing model to measure accuracy on the test file\n :param log_dir: str, path to model directory\n :param train_params: dict, training parameters\n :param train_history_path: str, path train history (json file)\n :param hyperparameter_hash: str, hyperparameter hash kept in training history\n :param train_history: dict, train history\n :param test_path: path to test file\n :param label_prefix: label prefix\n :param flush: flush after printing\n :return: None, prints the accuracy of the trained model on the test file\n '
print('Already trained with those hyper-parameters', flush=flush)
not_done = False
top_k = train_params['top_k']
if (test_path in train_history[hyperparameter_hash]['scores']):
if ((str(top_k) in train_history[hyperparameter_hash]['scores'][test_path]) and (str(1) in train_history[hyperparameter_hash]['scores'][test_path])):
for (k, v) in list(train_history[hyperparameter_hash]['scores'][test_path].items())[::(- 1)]:
print('The accuracy on top {} was {}'.format(k, v), flush=flush)
else:
not_done = True
else:
not_done = True
if not_done:
(test_descriptions, test_labels) = parse_txt(test_path, label_prefix=label_prefix)
model = FastTextModel(model_path=os.path.join(log_dir, 'model_best.pb'), model_params_path=os.path.join(log_dir, 'model_params.json'), label_prefix=label_prefix, use_gpu=train_params['use_gpu'], gpu_fraction=train_params['gpu_fraction'])
(predictions, _) = model.predict(list_of_texts=test_descriptions, k=top_k, batch_size=train_params['batch_size_inference'])
(right_predictions_top_1, right_predictions_top_k) = (0, 0)
for (true_label, predictions_k) in zip(test_labels, predictions):
if (true_label == predictions_k[0]):
right_predictions_top_1 += 1
if (true_label in predictions_k):
right_predictions_top_k += 1
top_1_score = round(((100 * right_predictions_top_1) / len(test_descriptions)), 2)
top_k_score = round(((100 * right_predictions_top_k) / len(test_descriptions)), 2)
print('\nThe accuracy on top {} was {}'.format(1, top_1_score), flush=flush)
print('The accuracy on top {} was {}'.format(top_k, top_k_score), flush=flush)
if (test_path not in train_history[hyperparameter_hash]['scores']):
train_history[hyperparameter_hash]['scores'][test_path] = dict()
train_history[hyperparameter_hash]['scores'][test_path][1] = top_1_score
train_history[hyperparameter_hash]['scores'][test_path][top_k] = top_k_score
with open(train_history_path, 'w+') as outfile:
json.dump(train_history, outfile)<|docstring|>Use an existing model to measure accuracy on the test file
:param log_dir: str, path to model directory
:param train_params: dict, training parameters
:param train_history_path: str, path train history (json file)
:param hyperparameter_hash: str, hyperparameter hash kept in training history
:param train_history: dict, train history
:param test_path: path to test file
:param label_prefix: label prefix
:param flush: flush after printing
:return: None, prints the accuracy of the trained model on the test file<|endoftext|> |
6d1c8921e9200e0c455ee47522923fbc4d59b3da02e3800dccf66326f4f3904a | def __init__(self, ignored_trusted_domains=None):
'Constructor for the UpdateIgnoredTrustedDomainsParams class'
self.ignored_trusted_domains = ignored_trusted_domains | Constructor for the UpdateIgnoredTrustedDomainsParams class | cohesity_management_sdk/models/update_ignored_trusted_domains_params.py | __init__ | nick6655/management-sdk-python | 18 | python | def __init__(self, ignored_trusted_domains=None):
self.ignored_trusted_domains = ignored_trusted_domains | def __init__(self, ignored_trusted_domains=None):
self.ignored_trusted_domains = ignored_trusted_domains<|docstring|>Constructor for the UpdateIgnoredTrustedDomainsParams class<|endoftext|> |
27570284fa04f502377a475fa830cc24fb4330e896f5d91982d6b7eb0c070ff7 | @classmethod
def from_dictionary(cls, dictionary):
"Creates an instance of this model from a dictionary\n\n Args:\n dictionary (dictionary): A dictionary representation of the object as\n obtained from the deserialization of the server's response. The keys\n MUST match property names in the API description.\n\n Returns:\n object: An instance of this structure class.\n\n "
if (dictionary is None):
return None
ignored_trusted_domains = dictionary.get('ignoredTrustedDomains')
return cls(ignored_trusted_domains) | Creates an instance of this model from a dictionary
Args:
dictionary (dictionary): A dictionary representation of the object as
obtained from the deserialization of the server's response. The keys
MUST match property names in the API description.
Returns:
object: An instance of this structure class. | cohesity_management_sdk/models/update_ignored_trusted_domains_params.py | from_dictionary | nick6655/management-sdk-python | 18 | python | @classmethod
def from_dictionary(cls, dictionary):
"Creates an instance of this model from a dictionary\n\n Args:\n dictionary (dictionary): A dictionary representation of the object as\n obtained from the deserialization of the server's response. The keys\n MUST match property names in the API description.\n\n Returns:\n object: An instance of this structure class.\n\n "
if (dictionary is None):
return None
ignored_trusted_domains = dictionary.get('ignoredTrustedDomains')
return cls(ignored_trusted_domains) | @classmethod
def from_dictionary(cls, dictionary):
"Creates an instance of this model from a dictionary\n\n Args:\n dictionary (dictionary): A dictionary representation of the object as\n obtained from the deserialization of the server's response. The keys\n MUST match property names in the API description.\n\n Returns:\n object: An instance of this structure class.\n\n "
if (dictionary is None):
return None
ignored_trusted_domains = dictionary.get('ignoredTrustedDomains')
return cls(ignored_trusted_domains)<|docstring|>Creates an instance of this model from a dictionary
Args:
dictionary (dictionary): A dictionary representation of the object as
obtained from the deserialization of the server's response. The keys
MUST match property names in the API description.
Returns:
object: An instance of this structure class.<|endoftext|> |
176ce866486bf551e7c056c7ec11f9de290a73167b489d3d6acb34ad0b69da73 | def visit_nodes(start_nodes: Iterable[_H], visitor: Callable[([_H], Iterable[_H])]) -> Set[_H]:
'\n Starting with `start_nodes`, call `visitor` with each node.\n `visitor` should return discovered nodes to be visited.\n Each node is visited exactly once.\n The set of all visited nodes is returned.\n '
remaining = set(start_nodes)
visited = set()
while remaining:
node = remaining.pop()
visited.add(node)
discovered = visitor(node)
remaining.update((n for n in discovered if (n not in visited)))
return visited | Starting with `start_nodes`, call `visitor` with each node.
`visitor` should return discovered nodes to be visited.
Each node is visited exactly once.
The set of all visited nodes is returned. | pithy/graph.py | visit_nodes | gwk/glossy | 7 | python | def visit_nodes(start_nodes: Iterable[_H], visitor: Callable[([_H], Iterable[_H])]) -> Set[_H]:
'\n Starting with `start_nodes`, call `visitor` with each node.\n `visitor` should return discovered nodes to be visited.\n Each node is visited exactly once.\n The set of all visited nodes is returned.\n '
remaining = set(start_nodes)
visited = set()
while remaining:
node = remaining.pop()
visited.add(node)
discovered = visitor(node)
remaining.update((n for n in discovered if (n not in visited)))
return visited | def visit_nodes(start_nodes: Iterable[_H], visitor: Callable[([_H], Iterable[_H])]) -> Set[_H]:
'\n Starting with `start_nodes`, call `visitor` with each node.\n `visitor` should return discovered nodes to be visited.\n Each node is visited exactly once.\n The set of all visited nodes is returned.\n '
remaining = set(start_nodes)
visited = set()
while remaining:
node = remaining.pop()
visited.add(node)
discovered = visitor(node)
remaining.update((n for n in discovered if (n not in visited)))
return visited<|docstring|>Starting with `start_nodes`, call `visitor` with each node.
`visitor` should return discovered nodes to be visited.
Each node is visited exactly once.
The set of all visited nodes is returned.<|endoftext|> |
ec034690e63ce36ec010ffb9bf2bd200edfb1804da13c6b78c8b1d32f9a04595 | def equal_weighting(X, types):
'\n Calculate criteria weights using objective Equal weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n\n Returns\n -------\n ndarray\n vector of criteria weights\n '
N = np.shape(X)[1]
return (np.ones(N) / N) | Calculate criteria weights using objective Equal weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights | objective_weighting/weighting_methods.py | equal_weighting | energyinpython/pre-objective-weighting | 0 | python | def equal_weighting(X, types):
'\n Calculate criteria weights using objective Equal weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n\n Returns\n -------\n ndarray\n vector of criteria weights\n '
N = np.shape(X)[1]
return (np.ones(N) / N) | def equal_weighting(X, types):
'\n Calculate criteria weights using objective Equal weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n\n Returns\n -------\n ndarray\n vector of criteria weights\n '
N = np.shape(X)[1]
return (np.ones(N) / N)<|docstring|>Calculate criteria weights using objective Equal weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights<|endoftext|> |
fd1561718d2e984d43e3b395d75af70045cfd660049b6e4a1c671d225255763e | def entropy_weighting(X, types):
'\n Calculate criteria weights using objective Entropy weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n\n Returns\n -------\n ndarray\n vector of criteria weights\n '
criteria_type = np.ones(np.shape(X)[1])
pij = sum_normalization(X, criteria_type)
pij = np.abs(pij)
(m, n) = np.shape(pij)
H = np.zeros((m, n))
for (j, i) in itertools.product(range(n), range(m)):
if pij[(i, j)]:
H[(i, j)] = (pij[(i, j)] * np.log(pij[(i, j)]))
h = (np.sum(H, axis=0) * ((- 1) * (np.log(m) ** (- 1))))
d = (1 - h)
w = (d / np.sum(d))
return w | Calculate criteria weights using objective Entropy weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights | objective_weighting/weighting_methods.py | entropy_weighting | energyinpython/pre-objective-weighting | 0 | python | def entropy_weighting(X, types):
'\n Calculate criteria weights using objective Entropy weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n\n Returns\n -------\n ndarray\n vector of criteria weights\n '
criteria_type = np.ones(np.shape(X)[1])
pij = sum_normalization(X, criteria_type)
pij = np.abs(pij)
(m, n) = np.shape(pij)
H = np.zeros((m, n))
for (j, i) in itertools.product(range(n), range(m)):
if pij[(i, j)]:
H[(i, j)] = (pij[(i, j)] * np.log(pij[(i, j)]))
h = (np.sum(H, axis=0) * ((- 1) * (np.log(m) ** (- 1))))
d = (1 - h)
w = (d / np.sum(d))
return w | def entropy_weighting(X, types):
'\n Calculate criteria weights using objective Entropy weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n\n Returns\n -------\n ndarray\n vector of criteria weights\n '
criteria_type = np.ones(np.shape(X)[1])
pij = sum_normalization(X, criteria_type)
pij = np.abs(pij)
(m, n) = np.shape(pij)
H = np.zeros((m, n))
for (j, i) in itertools.product(range(n), range(m)):
if pij[(i, j)]:
H[(i, j)] = (pij[(i, j)] * np.log(pij[(i, j)]))
h = (np.sum(H, axis=0) * ((- 1) * (np.log(m) ** (- 1))))
d = (1 - h)
w = (d / np.sum(d))
return w<|docstring|>Calculate criteria weights using objective Entropy weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights<|endoftext|> |
0a3689f59e4ec7cc80d0c963b5c3279206076c2baf821aec1e4d0813d5d44413 | def std_weighting(X, types):
'\n Calculate criteria weights using objective Standard deviation weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
stdv = np.sqrt((np.sum(np.square((X - np.mean(X, axis=0))), axis=0) / X.shape[0]))
return (stdv / np.sum(stdv)) | Calculate criteria weights using objective Standard deviation weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights | objective_weighting/weighting_methods.py | std_weighting | energyinpython/pre-objective-weighting | 0 | python | def std_weighting(X, types):
'\n Calculate criteria weights using objective Standard deviation weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
stdv = np.sqrt((np.sum(np.square((X - np.mean(X, axis=0))), axis=0) / X.shape[0]))
return (stdv / np.sum(stdv)) | def std_weighting(X, types):
'\n Calculate criteria weights using objective Standard deviation weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
stdv = np.sqrt((np.sum(np.square((X - np.mean(X, axis=0))), axis=0) / X.shape[0]))
return (stdv / np.sum(stdv))<|docstring|>Calculate criteria weights using objective Standard deviation weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights<|endoftext|> |
a38e5187ef9ec68c11e54b5cd6f776bc54e1ee7dd108ae965e654d9b3c71bd61 | def critic_weighting(X, types):
'\n Calculate criteria weights using objective CRITIC weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
criteria_type = np.ones(np.shape(X)[1])
x_norm = minmax_normalization(X, criteria_type)
std = np.std(x_norm, axis=0)
n = np.shape(x_norm)[1]
correlations = np.zeros((n, n))
for (i, j) in itertools.product(range(n), range(n)):
correlations[(i, j)] = pearson_coeff(x_norm[(:, i)], x_norm[(:, j)])
difference = (1 - correlations)
C = (std * np.sum(difference, axis=0))
w = (C / np.sum(C))
return w | Calculate criteria weights using objective CRITIC weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights | objective_weighting/weighting_methods.py | critic_weighting | energyinpython/pre-objective-weighting | 0 | python | def critic_weighting(X, types):
'\n Calculate criteria weights using objective CRITIC weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
criteria_type = np.ones(np.shape(X)[1])
x_norm = minmax_normalization(X, criteria_type)
std = np.std(x_norm, axis=0)
n = np.shape(x_norm)[1]
correlations = np.zeros((n, n))
for (i, j) in itertools.product(range(n), range(n)):
correlations[(i, j)] = pearson_coeff(x_norm[(:, i)], x_norm[(:, j)])
difference = (1 - correlations)
C = (std * np.sum(difference, axis=0))
w = (C / np.sum(C))
return w | def critic_weighting(X, types):
'\n Calculate criteria weights using objective CRITIC weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
criteria_type = np.ones(np.shape(X)[1])
x_norm = minmax_normalization(X, criteria_type)
std = np.std(x_norm, axis=0)
n = np.shape(x_norm)[1]
correlations = np.zeros((n, n))
for (i, j) in itertools.product(range(n), range(n)):
correlations[(i, j)] = pearson_coeff(x_norm[(:, i)], x_norm[(:, j)])
difference = (1 - correlations)
C = (std * np.sum(difference, axis=0))
w = (C / np.sum(C))
return w<|docstring|>Calculate criteria weights using objective CRITIC weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights<|endoftext|> |
bcf8eca2429b98ae5ac19dd1a7a5e1b84eedc82247eb1e71566c7d09fe8e5921 | def gini_weighting(X, types):
'\n Calculate criteria weights using objective Gini coefficient-based weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
(m, n) = np.shape(X)
G = np.zeros(n)
for j in range(0, n):
Yi = np.zeros(m)
if (np.mean(X[(:, j)]) != 0):
for (i, k) in itertools.product(range(m), range(m)):
Yi[i] += (np.abs((X[(i, j)] - X[(k, j)])) / ((2 * (m ** 2)) * (np.sum(X[(:, j)]) / m)))
else:
for (i, k) in itertools.product(range(m), range(m)):
Yi[i] += (np.abs((X[(i, j)] - X[(k, j)])) / ((m ** 2) - m))
G[j] = np.sum(Yi)
return (G / np.sum(G)) | Calculate criteria weights using objective Gini coefficient-based weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights | objective_weighting/weighting_methods.py | gini_weighting | energyinpython/pre-objective-weighting | 0 | python | def gini_weighting(X, types):
'\n Calculate criteria weights using objective Gini coefficient-based weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
(m, n) = np.shape(X)
G = np.zeros(n)
for j in range(0, n):
Yi = np.zeros(m)
if (np.mean(X[(:, j)]) != 0):
for (i, k) in itertools.product(range(m), range(m)):
Yi[i] += (np.abs((X[(i, j)] - X[(k, j)])) / ((2 * (m ** 2)) * (np.sum(X[(:, j)]) / m)))
else:
for (i, k) in itertools.product(range(m), range(m)):
Yi[i] += (np.abs((X[(i, j)] - X[(k, j)])) / ((m ** 2) - m))
G[j] = np.sum(Yi)
return (G / np.sum(G)) | def gini_weighting(X, types):
'\n Calculate criteria weights using objective Gini coefficient-based weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
(m, n) = np.shape(X)
G = np.zeros(n)
for j in range(0, n):
Yi = np.zeros(m)
if (np.mean(X[(:, j)]) != 0):
for (i, k) in itertools.product(range(m), range(m)):
Yi[i] += (np.abs((X[(i, j)] - X[(k, j)])) / ((2 * (m ** 2)) * (np.sum(X[(:, j)]) / m)))
else:
for (i, k) in itertools.product(range(m), range(m)):
Yi[i] += (np.abs((X[(i, j)] - X[(k, j)])) / ((m ** 2) - m))
G[j] = np.sum(Yi)
return (G / np.sum(G))<|docstring|>Calculate criteria weights using objective Gini coefficient-based weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights<|endoftext|> |
e5b8f4a272886cb14d4a3f38490c9fc730e6ec66c76d32552d26871d28519b30 | def merec_weighting(matrix, types):
'\n Calculate criteria weights using objective MEREC weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
X = copy.deepcopy(matrix)
(m, n) = X.shape
X = np.abs(X)
norm_matrix = np.zeros(X.shape)
norm_matrix[(:, (types == 1))] = (np.min(X[(:, (types == 1))], axis=0) / X[(:, (types == 1))])
norm_matrix[(:, (types == (- 1)))] = (X[(:, (types == (- 1)))] / np.max(X[(:, (types == (- 1)))], axis=0))
S = np.log((1 + ((1 / n) * np.sum(np.abs(np.log(norm_matrix)), axis=1))))
Sp = np.zeros(X.shape)
for j in range(n):
norm_mat = np.delete(norm_matrix, j, axis=1)
Sp[(:, j)] = np.log((1 + ((1 / n) * np.sum(np.abs(np.log(norm_mat)), axis=1))))
E = np.sum(np.abs((Sp - S.reshape((- 1), 1))), axis=0)
w = (E / np.sum(E))
return w | Calculate criteria weights using objective MEREC weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights | objective_weighting/weighting_methods.py | merec_weighting | energyinpython/pre-objective-weighting | 0 | python | def merec_weighting(matrix, types):
'\n Calculate criteria weights using objective MEREC weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
X = copy.deepcopy(matrix)
(m, n) = X.shape
X = np.abs(X)
norm_matrix = np.zeros(X.shape)
norm_matrix[(:, (types == 1))] = (np.min(X[(:, (types == 1))], axis=0) / X[(:, (types == 1))])
norm_matrix[(:, (types == (- 1)))] = (X[(:, (types == (- 1)))] / np.max(X[(:, (types == (- 1)))], axis=0))
S = np.log((1 + ((1 / n) * np.sum(np.abs(np.log(norm_matrix)), axis=1))))
Sp = np.zeros(X.shape)
for j in range(n):
norm_mat = np.delete(norm_matrix, j, axis=1)
Sp[(:, j)] = np.log((1 + ((1 / n) * np.sum(np.abs(np.log(norm_mat)), axis=1))))
E = np.sum(np.abs((Sp - S.reshape((- 1), 1))), axis=0)
w = (E / np.sum(E))
return w | def merec_weighting(matrix, types):
'\n Calculate criteria weights using objective MEREC weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
X = copy.deepcopy(matrix)
(m, n) = X.shape
X = np.abs(X)
norm_matrix = np.zeros(X.shape)
norm_matrix[(:, (types == 1))] = (np.min(X[(:, (types == 1))], axis=0) / X[(:, (types == 1))])
norm_matrix[(:, (types == (- 1)))] = (X[(:, (types == (- 1)))] / np.max(X[(:, (types == (- 1)))], axis=0))
S = np.log((1 + ((1 / n) * np.sum(np.abs(np.log(norm_matrix)), axis=1))))
Sp = np.zeros(X.shape)
for j in range(n):
norm_mat = np.delete(norm_matrix, j, axis=1)
Sp[(:, j)] = np.log((1 + ((1 / n) * np.sum(np.abs(np.log(norm_mat)), axis=1))))
E = np.sum(np.abs((Sp - S.reshape((- 1), 1))), axis=0)
w = (E / np.sum(E))
return w<|docstring|>Calculate criteria weights using objective MEREC weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights<|endoftext|> |
a3657086dab46dc05450b141c91c58506edce48b5e208f0ecaf48d418f13ea97 | def stat_var_weighting(X, types):
'\n Calculate criteria weights using objective Statistical variance weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
criteria_type = np.ones(np.shape(X)[1])
xn = minmax_normalization(X, criteria_type)
v = np.mean(np.square((xn - np.mean(xn, axis=0))), axis=0)
w = (v / np.sum(v))
return w | Calculate criteria weights using objective Statistical variance weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights | objective_weighting/weighting_methods.py | stat_var_weighting | energyinpython/pre-objective-weighting | 0 | python | def stat_var_weighting(X, types):
'\n Calculate criteria weights using objective Statistical variance weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
criteria_type = np.ones(np.shape(X)[1])
xn = minmax_normalization(X, criteria_type)
v = np.mean(np.square((xn - np.mean(xn, axis=0))), axis=0)
w = (v / np.sum(v))
return w | def stat_var_weighting(X, types):
'\n Calculate criteria weights using objective Statistical variance weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
criteria_type = np.ones(np.shape(X)[1])
xn = minmax_normalization(X, criteria_type)
v = np.mean(np.square((xn - np.mean(xn, axis=0))), axis=0)
w = (v / np.sum(v))
return w<|docstring|>Calculate criteria weights using objective Statistical variance weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights<|endoftext|> |
c25124d3d433d8398499b2b7c2f44b6f20eaac4d3a989544d10075c22824fdc4 | def cilos_weighting(X, types):
'\n Calculate criteria weights using objective CILOS weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
xr = copy.deepcopy(X)
xr[(:, (types == (- 1)))] = (np.min(X[(:, (types == (- 1)))], axis=0) / X[(:, (types == (- 1)))])
xn = (xr / np.sum(xr, axis=0))
A = xn[(np.argmax(xn, axis=0), :)]
pij = np.zeros((X.shape[1], X.shape[1]))
for (j, i) in itertools.product(range(X.shape[1]), range(X.shape[1])):
pij[(i, j)] = ((A[(j, j)] - A[(i, j)]) / A[(j, j)])
F = (np.diag((- np.sum((pij - np.diag(np.diag(pij))), axis=0))) + pij)
AA = np.zeros(F.shape[0])
AA[0] = sys.float_info.epsilon
q = np.linalg.inv(F).dot(AA)
return (q / np.sum(q)) | Calculate criteria weights using objective CILOS weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights | objective_weighting/weighting_methods.py | cilos_weighting | energyinpython/pre-objective-weighting | 0 | python | def cilos_weighting(X, types):
'\n Calculate criteria weights using objective CILOS weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
xr = copy.deepcopy(X)
xr[(:, (types == (- 1)))] = (np.min(X[(:, (types == (- 1)))], axis=0) / X[(:, (types == (- 1)))])
xn = (xr / np.sum(xr, axis=0))
A = xn[(np.argmax(xn, axis=0), :)]
pij = np.zeros((X.shape[1], X.shape[1]))
for (j, i) in itertools.product(range(X.shape[1]), range(X.shape[1])):
pij[(i, j)] = ((A[(j, j)] - A[(i, j)]) / A[(j, j)])
F = (np.diag((- np.sum((pij - np.diag(np.diag(pij))), axis=0))) + pij)
AA = np.zeros(F.shape[0])
AA[0] = sys.float_info.epsilon
q = np.linalg.inv(F).dot(AA)
return (q / np.sum(q)) | def cilos_weighting(X, types):
'\n Calculate criteria weights using objective CILOS weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
xr = copy.deepcopy(X)
xr[(:, (types == (- 1)))] = (np.min(X[(:, (types == (- 1)))], axis=0) / X[(:, (types == (- 1)))])
xn = (xr / np.sum(xr, axis=0))
A = xn[(np.argmax(xn, axis=0), :)]
pij = np.zeros((X.shape[1], X.shape[1]))
for (j, i) in itertools.product(range(X.shape[1]), range(X.shape[1])):
pij[(i, j)] = ((A[(j, j)] - A[(i, j)]) / A[(j, j)])
F = (np.diag((- np.sum((pij - np.diag(np.diag(pij))), axis=0))) + pij)
AA = np.zeros(F.shape[0])
AA[0] = sys.float_info.epsilon
q = np.linalg.inv(F).dot(AA)
return (q / np.sum(q))<|docstring|>Calculate criteria weights using objective CILOS weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights<|endoftext|> |
a68ddc7e679430aed1c6ac6318c8db8a3b2c17d57730b8e327ec0587ae3f36e8 | def idocriw_weighting(X, types):
'\n Calculate criteria weights using objective IDOCRIW weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
q = entropy_weighting(X, types)
w = cilos_weighting(X, types)
weights = ((q * w) / np.sum((q * w)))
return weights | Calculate criteria weights using objective IDOCRIW weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights | objective_weighting/weighting_methods.py | idocriw_weighting | energyinpython/pre-objective-weighting | 0 | python | def idocriw_weighting(X, types):
'\n Calculate criteria weights using objective IDOCRIW weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
q = entropy_weighting(X, types)
w = cilos_weighting(X, types)
weights = ((q * w) / np.sum((q * w)))
return weights | def idocriw_weighting(X, types):
'\n Calculate criteria weights using objective IDOCRIW weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
q = entropy_weighting(X, types)
w = cilos_weighting(X, types)
weights = ((q * w) / np.sum((q * w)))
return weights<|docstring|>Calculate criteria weights using objective IDOCRIW weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights<|endoftext|> |
e71de466d8e04ceb33844a6c0350521c88e0e54aaa6996d86d6381400401a5a3 | def angle_weighting(X, types):
'\n Calculate criteria weights using objective Angle weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
(m, n) = X.shape
X = sum_normalization(X, types)
B = (np.ones(m) * (1 / m))
u = np.arccos((np.sum((X / m), axis=0) / (np.sqrt(np.sum((X ** 2), axis=0)) * np.sqrt(np.sum((B ** 2))))))
w = (u / np.sum(u))
return w | Calculate criteria weights using objective Angle weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights | objective_weighting/weighting_methods.py | angle_weighting | energyinpython/pre-objective-weighting | 0 | python | def angle_weighting(X, types):
'\n Calculate criteria weights using objective Angle weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
(m, n) = X.shape
X = sum_normalization(X, types)
B = (np.ones(m) * (1 / m))
u = np.arccos((np.sum((X / m), axis=0) / (np.sqrt(np.sum((X ** 2), axis=0)) * np.sqrt(np.sum((B ** 2))))))
w = (u / np.sum(u))
return w | def angle_weighting(X, types):
'\n Calculate criteria weights using objective Angle weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
(m, n) = X.shape
X = sum_normalization(X, types)
B = (np.ones(m) * (1 / m))
u = np.arccos((np.sum((X / m), axis=0) / (np.sqrt(np.sum((X ** 2), axis=0)) * np.sqrt(np.sum((B ** 2))))))
w = (u / np.sum(u))
return w<|docstring|>Calculate criteria weights using objective Angle weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights<|endoftext|> |
712566aecc7b083600f832e077a8dc836e3959748cae55b33695c63d688b9ea5 | def coeff_var_weighting(X, types):
'\n Calculate criteria weights using objective Coefficient of variation weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
(m, n) = X.shape
criteria_types = np.ones(n)
B = sum_normalization(X, criteria_types)
Bm = (np.sum(B, axis=0) / m)
std = np.sqrt((np.sum(((B - Bm) ** 2), axis=0) / (m - 1)))
ej = (std / Bm)
w = (ej / np.sum(ej))
return w | Calculate criteria weights using objective Coefficient of variation weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights | objective_weighting/weighting_methods.py | coeff_var_weighting | energyinpython/pre-objective-weighting | 0 | python | def coeff_var_weighting(X, types):
'\n Calculate criteria weights using objective Coefficient of variation weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
(m, n) = X.shape
criteria_types = np.ones(n)
B = sum_normalization(X, criteria_types)
Bm = (np.sum(B, axis=0) / m)
std = np.sqrt((np.sum(((B - Bm) ** 2), axis=0) / (m - 1)))
ej = (std / Bm)
w = (ej / np.sum(ej))
return w | def coeff_var_weighting(X, types):
'\n Calculate criteria weights using objective Coefficient of variation weighting method\n Parameters\n ----------\n X : ndarray\n Decision matrix with performance values of m alternatives and n criteria\n types : ndarray\n \n Returns\n -------\n ndarray\n vector of criteria weights\n '
(m, n) = X.shape
criteria_types = np.ones(n)
B = sum_normalization(X, criteria_types)
Bm = (np.sum(B, axis=0) / m)
std = np.sqrt((np.sum(((B - Bm) ** 2), axis=0) / (m - 1)))
ej = (std / Bm)
w = (ej / np.sum(ej))
return w<|docstring|>Calculate criteria weights using objective Coefficient of variation weighting method
Parameters
----------
X : ndarray
Decision matrix with performance values of m alternatives and n criteria
types : ndarray
Returns
-------
ndarray
vector of criteria weights<|endoftext|> |
f429b4ff5f1099c2bf66fc8830b8a1b8fe1ec3f7bffd732e774540a6de5c3db8 | def _compute_fans(shape, data_format='channels_last'):
'Computes the number of input and output units for a weight shape.\n # Arguments\n shape: Integer shape tuple.\n data_format: Image data format to use for convolution kernels.\n Note that all kernels in Keras are standardized on the\n `channels_last` ordering (even when inputs are set\n to `channels_first`).\n # Returns\n A tuple of scalars, `(fan_in, fan_out)`.\n # Raises\n ValueError: in case of invalid `data_format` argument.\n '
if (len(shape) == 2):
fan_in = shape[0]
fan_out = shape[1]
elif (len(shape) in {3, 4, 5}):
if (data_format == 'channels_first'):
receptive_field_size = np.prod(shape[2:])
fan_in = (shape[1] * receptive_field_size)
fan_out = (shape[0] * receptive_field_size)
elif (data_format == 'channels_last'):
receptive_field_size = np.prod(shape[:(- 2)])
fan_in = (shape[(- 2)] * receptive_field_size)
fan_out = (shape[(- 1)] * receptive_field_size)
else:
raise ValueError(('Invalid data_format: ' + data_format))
else:
fan_in = np.sqrt(np.prod(shape))
fan_out = np.sqrt(np.prod(shape))
return (fan_in, fan_out) | Computes the number of input and output units for a weight shape.
# Arguments
shape: Integer shape tuple.
data_format: Image data format to use for convolution kernels.
Note that all kernels in Keras are standardized on the
`channels_last` ordering (even when inputs are set
to `channels_first`).
# Returns
A tuple of scalars, `(fan_in, fan_out)`.
# Raises
ValueError: in case of invalid `data_format` argument. | nnlib/CAInitializer.py | _compute_fans | Topaz1618/Plasticine | 0 | python | def _compute_fans(shape, data_format='channels_last'):
'Computes the number of input and output units for a weight shape.\n # Arguments\n shape: Integer shape tuple.\n data_format: Image data format to use for convolution kernels.\n Note that all kernels in Keras are standardized on the\n `channels_last` ordering (even when inputs are set\n to `channels_first`).\n # Returns\n A tuple of scalars, `(fan_in, fan_out)`.\n # Raises\n ValueError: in case of invalid `data_format` argument.\n '
if (len(shape) == 2):
fan_in = shape[0]
fan_out = shape[1]
elif (len(shape) in {3, 4, 5}):
if (data_format == 'channels_first'):
receptive_field_size = np.prod(shape[2:])
fan_in = (shape[1] * receptive_field_size)
fan_out = (shape[0] * receptive_field_size)
elif (data_format == 'channels_last'):
receptive_field_size = np.prod(shape[:(- 2)])
fan_in = (shape[(- 2)] * receptive_field_size)
fan_out = (shape[(- 1)] * receptive_field_size)
else:
raise ValueError(('Invalid data_format: ' + data_format))
else:
fan_in = np.sqrt(np.prod(shape))
fan_out = np.sqrt(np.prod(shape))
return (fan_in, fan_out) | def _compute_fans(shape, data_format='channels_last'):
'Computes the number of input and output units for a weight shape.\n # Arguments\n shape: Integer shape tuple.\n data_format: Image data format to use for convolution kernels.\n Note that all kernels in Keras are standardized on the\n `channels_last` ordering (even when inputs are set\n to `channels_first`).\n # Returns\n A tuple of scalars, `(fan_in, fan_out)`.\n # Raises\n ValueError: in case of invalid `data_format` argument.\n '
if (len(shape) == 2):
fan_in = shape[0]
fan_out = shape[1]
elif (len(shape) in {3, 4, 5}):
if (data_format == 'channels_first'):
receptive_field_size = np.prod(shape[2:])
fan_in = (shape[1] * receptive_field_size)
fan_out = (shape[0] * receptive_field_size)
elif (data_format == 'channels_last'):
receptive_field_size = np.prod(shape[:(- 2)])
fan_in = (shape[(- 2)] * receptive_field_size)
fan_out = (shape[(- 1)] * receptive_field_size)
else:
raise ValueError(('Invalid data_format: ' + data_format))
else:
fan_in = np.sqrt(np.prod(shape))
fan_out = np.sqrt(np.prod(shape))
return (fan_in, fan_out)<|docstring|>Computes the number of input and output units for a weight shape.
# Arguments
shape: Integer shape tuple.
data_format: Image data format to use for convolution kernels.
Note that all kernels in Keras are standardized on the
`channels_last` ordering (even when inputs are set
to `channels_first`).
# Returns
A tuple of scalars, `(fan_in, fan_out)`.
# Raises
ValueError: in case of invalid `data_format` argument.<|endoftext|> |
b5b40ee27c19a6c5f742334eb6cf63dcf692775ed3265cbda613565c87d3a90f | @app.route('/')
def index():
'Returns the list of languages available in github\n with the epoch date on which they were added to it'
langs_db = languages_db()
if langs_db:
languages = langs_db['languages']
timestamp = int(langs_db['timestamp'].strftime('%s'))
else:
languages = []
timestamp = int(time.time())
ret = json.dumps({'languages': languages, 'timestamp': timestamp})
resp = Response(response=ret, status=200, mimetype='application/json')
return resp | Returns the list of languages available in github
with the epoch date on which they were added to it | api/web.py | index | unbalancedparentheses/indielangs | 4 | python | @app.route('/')
def index():
'Returns the list of languages available in github\n with the epoch date on which they were added to it'
langs_db = languages_db()
if langs_db:
languages = langs_db['languages']
timestamp = int(langs_db['timestamp'].strftime('%s'))
else:
languages = []
timestamp = int(time.time())
ret = json.dumps({'languages': languages, 'timestamp': timestamp})
resp = Response(response=ret, status=200, mimetype='application/json')
return resp | @app.route('/')
def index():
'Returns the list of languages available in github\n with the epoch date on which they were added to it'
langs_db = languages_db()
if langs_db:
languages = langs_db['languages']
timestamp = int(langs_db['timestamp'].strftime('%s'))
else:
languages = []
timestamp = int(time.time())
ret = json.dumps({'languages': languages, 'timestamp': timestamp})
resp = Response(response=ret, status=200, mimetype='application/json')
return resp<|docstring|>Returns the list of languages available in github
with the epoch date on which they were added to it<|endoftext|> |
71de24ba4d294e8963670b2a29b3e6a6703b78b56d2a400fc5eea3bd1b94dfc3 | def languages_db():
'Get the languages stored in the database'
s_langs = r.db('indielangs').table('languages').order_by(r.desc('timestamp')).limit(1).run(DB)
if (len(s_langs) != 0):
return s_langs[0]
else:
return {} | Get the languages stored in the database | api/web.py | languages_db | unbalancedparentheses/indielangs | 4 | python | def languages_db():
s_langs = r.db('indielangs').table('languages').order_by(r.desc('timestamp')).limit(1).run(DB)
if (len(s_langs) != 0):
return s_langs[0]
else:
return {} | def languages_db():
s_langs = r.db('indielangs').table('languages').order_by(r.desc('timestamp')).limit(1).run(DB)
if (len(s_langs) != 0):
return s_langs[0]
else:
return {}<|docstring|>Get the languages stored in the database<|endoftext|> |
ac4b71fa13fb6809dc6fb7c7a64f62d76ce6538ecde4782593a86a7c1c980f50 | def make_hierarchical_dict(d, sep=u':'):
'\n Given a flat dict d, each key in d is broken up by the separator\n sep, and a hierarchical dict is returned.\n '
assert (type(d) == dict)
assert (type(sep) == unicode)
result = {}
for (key, value) in d.items():
path = key.split(sep)
curr_dict = result
for (i, directory) in enumerate(path):
if (i == (len(path) - 1)):
assert (directory not in curr_dict)
curr_dict[directory] = value
else:
if (directory in curr_dict):
assert (type(curr_dict[directory]) == dict)
else:
curr_dict[directory] = {}
curr_dict = curr_dict[directory]
return result | Given a flat dict d, each key in d is broken up by the separator
sep, and a hierarchical dict is returned. | mangrove/utils/google_spreadsheets.py | make_hierarchical_dict | mariot/mangrove | 0 | python | def make_hierarchical_dict(d, sep=u':'):
'\n Given a flat dict d, each key in d is broken up by the separator\n sep, and a hierarchical dict is returned.\n '
assert (type(d) == dict)
assert (type(sep) == unicode)
result = {}
for (key, value) in d.items():
path = key.split(sep)
curr_dict = result
for (i, directory) in enumerate(path):
if (i == (len(path) - 1)):
assert (directory not in curr_dict)
curr_dict[directory] = value
else:
if (directory in curr_dict):
assert (type(curr_dict[directory]) == dict)
else:
curr_dict[directory] = {}
curr_dict = curr_dict[directory]
return result | def make_hierarchical_dict(d, sep=u':'):
'\n Given a flat dict d, each key in d is broken up by the separator\n sep, and a hierarchical dict is returned.\n '
assert (type(d) == dict)
assert (type(sep) == unicode)
result = {}
for (key, value) in d.items():
path = key.split(sep)
curr_dict = result
for (i, directory) in enumerate(path):
if (i == (len(path) - 1)):
assert (directory not in curr_dict)
curr_dict[directory] = value
else:
if (directory in curr_dict):
assert (type(curr_dict[directory]) == dict)
else:
curr_dict[directory] = {}
curr_dict = curr_dict[directory]
return result<|docstring|>Given a flat dict d, each key in d is broken up by the separator
sep, and a hierarchical dict is returned.<|endoftext|> |
d1de88b2543b8e11e073c974f54801fb3666524977725e468f47742f4752ef33 | def get_string(key, row):
'Reads a string from a row.'
if ((key in row) and row[key]):
return row[key].strip()
else:
return None | Reads a string from a row. | mangrove/utils/google_spreadsheets.py | get_string | mariot/mangrove | 0 | python | def get_string(key, row):
if ((key in row) and row[key]):
return row[key].strip()
else:
return None | def get_string(key, row):
if ((key in row) and row[key]):
return row[key].strip()
else:
return None<|docstring|>Reads a string from a row.<|endoftext|> |
5f519388fe9d62e4a0d0f28768d291ec1747ce7f9062b57ef2b8f96f1e7aa01b | def get_number(key, row):
'Reads a number from a row (assume all as float).'
if ((key in row) and row[key]):
return float(row[key])
else:
return None | Reads a number from a row (assume all as float). | mangrove/utils/google_spreadsheets.py | get_number | mariot/mangrove | 0 | python | def get_number(key, row):
if ((key in row) and row[key]):
return float(row[key])
else:
return None | def get_number(key, row):
if ((key in row) and row[key]):
return float(row[key])
else:
return None<|docstring|>Reads a number from a row (assume all as float).<|endoftext|> |
9f7e6962bb7e9332536a62a6131e2f168d3a46052a57ff5394841a87356e7342 | def get_percent(key, row):
'Reads a percentage from a row.'
if ((key in row) and row[key]):
percent = row[key]
if ('%' in percent):
return (float(percent.replace('%', '')) / 100.0)
else:
return float(percent)
else:
return None | Reads a percentage from a row. | mangrove/utils/google_spreadsheets.py | get_percent | mariot/mangrove | 0 | python | def get_percent(key, row):
if ((key in row) and row[key]):
percent = row[key]
if ('%' in percent):
return (float(percent.replace('%', )) / 100.0)
else:
return float(percent)
else:
return None | def get_percent(key, row):
if ((key in row) and row[key]):
percent = row[key]
if ('%' in percent):
return (float(percent.replace('%', )) / 100.0)
else:
return float(percent)
else:
return None<|docstring|>Reads a percentage from a row.<|endoftext|> |
47602af534e7af720a11883bf69fa3d515af558cb1fd63c4b76f426cb9e128a4 | def get_boolean(key, row):
'Reads a boolean from a row.'
if ((key in row) and row[key]):
value = row[key]
regex = re.compile('(true|t|yes|y|1)', re.IGNORECASE)
if regex.search(value):
return True
else:
return False
else:
return None | Reads a boolean from a row. | mangrove/utils/google_spreadsheets.py | get_boolean | mariot/mangrove | 0 | python | def get_boolean(key, row):
if ((key in row) and row[key]):
value = row[key]
regex = re.compile('(true|t|yes|y|1)', re.IGNORECASE)
if regex.search(value):
return True
else:
return False
else:
return None | def get_boolean(key, row):
if ((key in row) and row[key]):
value = row[key]
regex = re.compile('(true|t|yes|y|1)', re.IGNORECASE)
if regex.search(value):
return True
else:
return False
else:
return None<|docstring|>Reads a boolean from a row.<|endoftext|> |
c20dcb08d313d7b5b1e5c2f3650253e05677cdfbf5a16e318b2e462bff5f0e6f | def get_list(key, row):
'Reads a comma-separated list from a row (interpreted as strings).'
if ((key in row) and row[key]):
return [i.strip() for i in row[key].split(',') if i.strip()]
else:
return None | Reads a comma-separated list from a row (interpreted as strings). | mangrove/utils/google_spreadsheets.py | get_list | mariot/mangrove | 0 | python | def get_list(key, row):
if ((key in row) and row[key]):
return [i.strip() for i in row[key].split(',') if i.strip()]
else:
return None | def get_list(key, row):
if ((key in row) and row[key]):
return [i.strip() for i in row[key].split(',') if i.strip()]
else:
return None<|docstring|>Reads a comma-separated list from a row (interpreted as strings).<|endoftext|> |
4223dd871ddd4d75c90c63189bd3ccd012d17ed3b60c4a59dbca26416fd698d0 | def keys(self):
'\n Return a list containing the names of the worksheets in this\n spreadsheet.\n '
return self._worksheets.keys() | Return a list containing the names of the worksheets in this
spreadsheet. | mangrove/utils/google_spreadsheets.py | keys | mariot/mangrove | 0 | python | def keys(self):
'\n Return a list containing the names of the worksheets in this\n spreadsheet.\n '
return self._worksheets.keys() | def keys(self):
'\n Return a list containing the names of the worksheets in this\n spreadsheet.\n '
return self._worksheets.keys()<|docstring|>Return a list containing the names of the worksheets in this
spreadsheet.<|endoftext|> |
d95a2b22507619cb6905035e0d8f3ac8867e1b4b48b2605f59758782a32e7a1a | def __getitem__(self, title):
"\n Iterate over all the rows in the worksheet with this title in\n this spreadsheet. If x is a GoogleSpreadsheet object, then\n x['Sheet1'] will iterate over all the rows in 'Sheet1'\n returning a dict for each row.\n "
ws = self._worksheets[title]
wksht_id = ws.id.text.rsplit('/', 1)[(- 1)]
for entry in self._client.GetListFeed(self._key(), wksht_id).entry:
d = dict(zip(entry.custom.keys(), [value.text for value in entry.custom.values()]))
(yield make_hierarchical_dict(d)) | Iterate over all the rows in the worksheet with this title in
this spreadsheet. If x is a GoogleSpreadsheet object, then
x['Sheet1'] will iterate over all the rows in 'Sheet1'
returning a dict for each row. | mangrove/utils/google_spreadsheets.py | __getitem__ | mariot/mangrove | 0 | python | def __getitem__(self, title):
"\n Iterate over all the rows in the worksheet with this title in\n this spreadsheet. If x is a GoogleSpreadsheet object, then\n x['Sheet1'] will iterate over all the rows in 'Sheet1'\n returning a dict for each row.\n "
ws = self._worksheets[title]
wksht_id = ws.id.text.rsplit('/', 1)[(- 1)]
for entry in self._client.GetListFeed(self._key(), wksht_id).entry:
d = dict(zip(entry.custom.keys(), [value.text for value in entry.custom.values()]))
(yield make_hierarchical_dict(d)) | def __getitem__(self, title):
"\n Iterate over all the rows in the worksheet with this title in\n this spreadsheet. If x is a GoogleSpreadsheet object, then\n x['Sheet1'] will iterate over all the rows in 'Sheet1'\n returning a dict for each row.\n "
ws = self._worksheets[title]
wksht_id = ws.id.text.rsplit('/', 1)[(- 1)]
for entry in self._client.GetListFeed(self._key(), wksht_id).entry:
d = dict(zip(entry.custom.keys(), [value.text for value in entry.custom.values()]))
(yield make_hierarchical_dict(d))<|docstring|>Iterate over all the rows in the worksheet with this title in
this spreadsheet. If x is a GoogleSpreadsheet object, then
x['Sheet1'] will iterate over all the rows in 'Sheet1'
returning a dict for each row.<|endoftext|> |
c48c2634b467d6d9ef7ad7a4191b529115c0bc017211010a8442aa7db217fec2 | def keys(self):
'\n Return a list of titles of all the spreadsheets available to\n this user.\n '
return self._spreadsheets.keys() | Return a list of titles of all the spreadsheets available to
this user. | mangrove/utils/google_spreadsheets.py | keys | mariot/mangrove | 0 | python | def keys(self):
'\n Return a list of titles of all the spreadsheets available to\n this user.\n '
return self._spreadsheets.keys() | def keys(self):
'\n Return a list of titles of all the spreadsheets available to\n this user.\n '
return self._spreadsheets.keys()<|docstring|>Return a list of titles of all the spreadsheets available to
this user.<|endoftext|> |
e273cacd0bf8d2038c97e9e23babb16d547eb690e389027b2103eb23a129d072 | def __getitem__(self, title):
'\n Return the GoogleSpreadsheet object with this title.\n '
return self._spreadsheets[title] | Return the GoogleSpreadsheet object with this title. | mangrove/utils/google_spreadsheets.py | __getitem__ | mariot/mangrove | 0 | python | def __getitem__(self, title):
'\n \n '
return self._spreadsheets[title] | def __getitem__(self, title):
'\n \n '
return self._spreadsheets[title]<|docstring|>Return the GoogleSpreadsheet object with this title.<|endoftext|> |
8aaee5d6d423c6764fc00d6d1f0710f1beb501cbd7ac5b6d2561d5ba759be245 | def get_urls():
'\n Returns a list of urls by reading the txt file supplied as argument in terminal\n '
try:
url_input = sys.argv[1]
except IndexError:
print('ERROR: Please provide the txt file\n Example \n\n$python image_downloader.py dogs.txt \n\n')
sys.exit()
with open(url_input, 'r') as f:
images_url = f.read().splitlines()
print('{} Images detected'.format(len(images_url)))
return images_url | Returns a list of urls by reading the txt file supplied as argument in terminal | image_downloader.py | get_urls | nOOBIE-nOOBIE/image_downloader_multiprocessing_python | 17 | python | def get_urls():
'\n \n '
try:
url_input = sys.argv[1]
except IndexError:
print('ERROR: Please provide the txt file\n Example \n\n$python image_downloader.py dogs.txt \n\n')
sys.exit()
with open(url_input, 'r') as f:
images_url = f.read().splitlines()
print('{} Images detected'.format(len(images_url)))
return images_url | def get_urls():
'\n \n '
try:
url_input = sys.argv[1]
except IndexError:
print('ERROR: Please provide the txt file\n Example \n\n$python image_downloader.py dogs.txt \n\n')
sys.exit()
with open(url_input, 'r') as f:
images_url = f.read().splitlines()
print('{} Images detected'.format(len(images_url)))
return images_url<|docstring|>Returns a list of urls by reading the txt file supplied as argument in terminal<|endoftext|> |
44ecb329192fc2695d183fd4e77370347e5d4fa0b5978f621559427711cf6836 | def image_downloader(img_url: str):
'\n Input:\n param: img_url str (Image url)\n Tries to download the image url and use name provided in headers. Else it randomly picks a name\n '
print(f'Downloading: {img_url}')
res = requests.get(img_url, stream=True)
count = 1
while ((res.status_code != 200) and (count <= 5)):
res = requests.get(img_url, stream=True)
print(f'Retry: {count} {img_url}')
count += 1
if ('image' not in res.headers.get('content-type', '')):
print('ERROR: URL doesnot appear to be an image')
return False
try:
image_name = str(img_url[(img_url.rfind('/') + 1):])
if ('?' in image_name):
image_name = image_name[:image_name.find('?')]
except:
image_name = (str(random.randint(11111, 99999)) + '.jpg')
i = Image.open(io.BytesIO(res.content))
download_location = get_download_location()
i.save(((download_location + '/') + image_name))
return f'Download complete: {img_url}' | Input:
param: img_url str (Image url)
Tries to download the image url and use name provided in headers. Else it randomly picks a name | image_downloader.py | image_downloader | nOOBIE-nOOBIE/image_downloader_multiprocessing_python | 17 | python | def image_downloader(img_url: str):
'\n Input:\n param: img_url str (Image url)\n Tries to download the image url and use name provided in headers. Else it randomly picks a name\n '
print(f'Downloading: {img_url}')
res = requests.get(img_url, stream=True)
count = 1
while ((res.status_code != 200) and (count <= 5)):
res = requests.get(img_url, stream=True)
print(f'Retry: {count} {img_url}')
count += 1
if ('image' not in res.headers.get('content-type', )):
print('ERROR: URL doesnot appear to be an image')
return False
try:
image_name = str(img_url[(img_url.rfind('/') + 1):])
if ('?' in image_name):
image_name = image_name[:image_name.find('?')]
except:
image_name = (str(random.randint(11111, 99999)) + '.jpg')
i = Image.open(io.BytesIO(res.content))
download_location = get_download_location()
i.save(((download_location + '/') + image_name))
return f'Download complete: {img_url}' | def image_downloader(img_url: str):
'\n Input:\n param: img_url str (Image url)\n Tries to download the image url and use name provided in headers. Else it randomly picks a name\n '
print(f'Downloading: {img_url}')
res = requests.get(img_url, stream=True)
count = 1
while ((res.status_code != 200) and (count <= 5)):
res = requests.get(img_url, stream=True)
print(f'Retry: {count} {img_url}')
count += 1
if ('image' not in res.headers.get('content-type', )):
print('ERROR: URL doesnot appear to be an image')
return False
try:
image_name = str(img_url[(img_url.rfind('/') + 1):])
if ('?' in image_name):
image_name = image_name[:image_name.find('?')]
except:
image_name = (str(random.randint(11111, 99999)) + '.jpg')
i = Image.open(io.BytesIO(res.content))
download_location = get_download_location()
i.save(((download_location + '/') + image_name))
return f'Download complete: {img_url}'<|docstring|>Input:
param: img_url str (Image url)
Tries to download the image url and use name provided in headers. Else it randomly picks a name<|endoftext|> |
7cf15b9c810fc99b16f37b7fa26de269ec046d2c0f356efa107bae2a869e78f4 | def run_downloader(process: int, images_url: list):
'\n Inputs:\n process: (int) number of process to run\n images_url:(list) list of images url\n '
print(f'MESSAGE: Running {process} process')
results = ThreadPool(process).imap_unordered(image_downloader, images_url)
for r in results:
print(r) | Inputs:
process: (int) number of process to run
images_url:(list) list of images url | image_downloader.py | run_downloader | nOOBIE-nOOBIE/image_downloader_multiprocessing_python | 17 | python | def run_downloader(process: int, images_url: list):
'\n Inputs:\n process: (int) number of process to run\n images_url:(list) list of images url\n '
print(f'MESSAGE: Running {process} process')
results = ThreadPool(process).imap_unordered(image_downloader, images_url)
for r in results:
print(r) | def run_downloader(process: int, images_url: list):
'\n Inputs:\n process: (int) number of process to run\n images_url:(list) list of images url\n '
print(f'MESSAGE: Running {process} process')
results = ThreadPool(process).imap_unordered(image_downloader, images_url)
for r in results:
print(r)<|docstring|>Inputs:
process: (int) number of process to run
images_url:(list) list of images url<|endoftext|> |
1ee1f1d3adad42b7d1a38e86a96a8bfacaabbb22e701955ca87f098d04250bec | def camelCaseSplit(text):
'\n This function splits camel case into separate words\n :param text: Input text\n :return: array of words\n '
matches = re.finditer('.+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)', text)
return [m.group(0) for m in matches] | This function splits camel case into separate words
:param text: Input text
:return: array of words | bro_utils.py | camelCaseSplit | Nixellion/Arkbot | 4 | python | def camelCaseSplit(text):
'\n This function splits camel case into separate words\n :param text: Input text\n :return: array of words\n '
matches = re.finditer('.+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)', text)
return [m.group(0) for m in matches] | def camelCaseSplit(text):
'\n This function splits camel case into separate words\n :param text: Input text\n :return: array of words\n '
matches = re.finditer('.+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)', text)
return [m.group(0) for m in matches]<|docstring|>This function splits camel case into separate words
:param text: Input text
:return: array of words<|endoftext|> |
afb54335a4683726d2010a3c48bfd30f6aad83607c3fb184c3b44d93bae736f9 | def get_available_submodules(path):
'\n :param path: import path for the parent module a.b separated with dots\n '
parts = path.split('.')
filepath = os.path.join(APP_DIR, *parts)
files = os.listdir(filepath)
modules = []
for f in files:
(name, ext) = os.path.splitext(f)
if (ext.lower() == '.py'):
if ((not name.startswith('__')) and (not name.endswith('__'))):
if (name.lower() != 'base'):
modules.append(((path + '.') + name))
return modules | :param path: import path for the parent module a.b separated with dots | bro_utils.py | get_available_submodules | Nixellion/Arkbot | 4 | python | def get_available_submodules(path):
'\n \n '
parts = path.split('.')
filepath = os.path.join(APP_DIR, *parts)
files = os.listdir(filepath)
modules = []
for f in files:
(name, ext) = os.path.splitext(f)
if (ext.lower() == '.py'):
if ((not name.startswith('__')) and (not name.endswith('__'))):
if (name.lower() != 'base'):
modules.append(((path + '.') + name))
return modules | def get_available_submodules(path):
'\n \n '
parts = path.split('.')
filepath = os.path.join(APP_DIR, *parts)
files = os.listdir(filepath)
modules = []
for f in files:
(name, ext) = os.path.splitext(f)
if (ext.lower() == '.py'):
if ((not name.startswith('__')) and (not name.endswith('__'))):
if (name.lower() != 'base'):
modules.append(((path + '.') + name))
return modules<|docstring|>:param path: import path for the parent module a.b separated with dots<|endoftext|> |
b68a46115ca8217cc013cc8565555c3860309226c52a9906ebb92558153da671 | def vectorizeSeq(sequences, dimension=10000):
'\n function: sparse one-hot vector maker\n \n inputs:\n - sequences: work sequences\n - dimension: work frequency\n \n outputs:\n - res: sparse one-hot matrix\n '
res = np.zeros((len(sequences), dimension))
for (i, sequence) in enumerate(sequences):
res[(i, sequence)] = 1.0
return res | function: sparse one-hot vector maker
inputs:
- sequences: work sequences
- dimension: work frequency
outputs:
- res: sparse one-hot matrix | lec3-3[multilabel].py | vectorizeSeq | cutz-j/keras | 0 | python | def vectorizeSeq(sequences, dimension=10000):
'\n function: sparse one-hot vector maker\n \n inputs:\n - sequences: work sequences\n - dimension: work frequency\n \n outputs:\n - res: sparse one-hot matrix\n '
res = np.zeros((len(sequences), dimension))
for (i, sequence) in enumerate(sequences):
res[(i, sequence)] = 1.0
return res | def vectorizeSeq(sequences, dimension=10000):
'\n function: sparse one-hot vector maker\n \n inputs:\n - sequences: work sequences\n - dimension: work frequency\n \n outputs:\n - res: sparse one-hot matrix\n '
res = np.zeros((len(sequences), dimension))
for (i, sequence) in enumerate(sequences):
res[(i, sequence)] = 1.0
return res<|docstring|>function: sparse one-hot vector maker
inputs:
- sequences: work sequences
- dimension: work frequency
outputs:
- res: sparse one-hot matrix<|endoftext|> |
a515182710601952ba41eb6cff2a66b470c1f1a503ebfd866cee4d4cbeb129b1 | def chance(dice):
"Score the given role in the 'Chance' category "
return sum(dice) | Score the given role in the 'Chance' category | yatzy.py | chance | SGenheden/YatzyGameWithDoctest | 0 | python | def chance(dice):
" "
return sum(dice) | def chance(dice):
" "
return sum(dice)<|docstring|>Score the given role in the 'Chance' category<|endoftext|> |
a4474e2c32605435a4145b619d814682d064fe8277a92cc09ac8e8c5acadcd87 | def yatzy(dice):
"Score the given roll in the 'Yatzy' category "
counts = dice_counts(dice)
if (5 in counts.values()):
return 50
return 0 | Score the given roll in the 'Yatzy' category | yatzy.py | yatzy | SGenheden/YatzyGameWithDoctest | 0 | python | def yatzy(dice):
" "
counts = dice_counts(dice)
if (5 in counts.values()):
return 50
return 0 | def yatzy(dice):
" "
counts = dice_counts(dice)
if (5 in counts.values()):
return 50
return 0<|docstring|>Score the given roll in the 'Yatzy' category<|endoftext|> |
6ef50411db95c894193a451e625b8292c0e70d8dd528c2e5d08e79aabe3e433c | def small_straight(dice):
"Score the given roll in the 'Small Straight' category.\n "
if (sorted(dice) == [1, 2, 3, 4, 5]):
return sum(dice)
else:
return 0 | Score the given roll in the 'Small Straight' category. | yatzy.py | small_straight | SGenheden/YatzyGameWithDoctest | 0 | python | def small_straight(dice):
"\n "
if (sorted(dice) == [1, 2, 3, 4, 5]):
return sum(dice)
else:
return 0 | def small_straight(dice):
"\n "
if (sorted(dice) == [1, 2, 3, 4, 5]):
return sum(dice)
else:
return 0<|docstring|>Score the given roll in the 'Small Straight' category.<|endoftext|> |
a141a02f465fab120b8a4810dbd45fd7477cd876ebaa5fedaa83e23c1d2c157f | def large_straight(dice):
"Score the given roll in the 'Large Straight' category.\n "
if (sorted(dice) == [2, 3, 4, 5, 6]):
return sum(dice)
else:
return 0 | Score the given roll in the 'Large Straight' category. | yatzy.py | large_straight | SGenheden/YatzyGameWithDoctest | 0 | python | def large_straight(dice):
"\n "
if (sorted(dice) == [2, 3, 4, 5, 6]):
return sum(dice)
else:
return 0 | def large_straight(dice):
"\n "
if (sorted(dice) == [2, 3, 4, 5, 6]):
return sum(dice)
else:
return 0<|docstring|>Score the given roll in the 'Large Straight' category.<|endoftext|> |
3a4fed1705f7f4d3beadc16eae0a6181342709a2343956204304af148315663d | def pair(dice):
"Score the given roll in the 'Pair' category"
counts = dice_counts(dice)
for i in [6, 5, 4, 3, 2, 1]:
if (counts[i] >= 2):
return (2 * i)
return 0 | Score the given roll in the 'Pair' category | yatzy.py | pair | SGenheden/YatzyGameWithDoctest | 0 | python | def pair(dice):
counts = dice_counts(dice)
for i in [6, 5, 4, 3, 2, 1]:
if (counts[i] >= 2):
return (2 * i)
return 0 | def pair(dice):
counts = dice_counts(dice)
for i in [6, 5, 4, 3, 2, 1]:
if (counts[i] >= 2):
return (2 * i)
return 0<|docstring|>Score the given roll in the 'Pair' category<|endoftext|> |
1a5fd7a40c22be5d39734e51409266f1e6574626a4d2b42091d48b5d0ce7e1c1 | def three_of_a_kind(dice):
"Score the given roll in the 'Three of a kind' category"
counts = dice_counts(dice)
for i in [6, 5, 4, 3, 2, 1]:
if (counts[i] >= 3):
return (3 * i)
return 0 | Score the given roll in the 'Three of a kind' category | yatzy.py | three_of_a_kind | SGenheden/YatzyGameWithDoctest | 0 | python | def three_of_a_kind(dice):
counts = dice_counts(dice)
for i in [6, 5, 4, 3, 2, 1]:
if (counts[i] >= 3):
return (3 * i)
return 0 | def three_of_a_kind(dice):
counts = dice_counts(dice)
for i in [6, 5, 4, 3, 2, 1]:
if (counts[i] >= 3):
return (3 * i)
return 0<|docstring|>Score the given roll in the 'Three of a kind' category<|endoftext|> |
968313931f0c211a106e447895dc2f27e811a67a23af4990b32a89d29d59c1f0 | def four_of_a_kind(dice):
"Score the given roll in the 'Four of a kind' category"
counts = dice_counts(dice)
for i in [6, 5, 4, 3, 2, 1]:
if (counts[i] >= 4):
return (4 * i)
return 0 | Score the given roll in the 'Four of a kind' category | yatzy.py | four_of_a_kind | SGenheden/YatzyGameWithDoctest | 0 | python | def four_of_a_kind(dice):
counts = dice_counts(dice)
for i in [6, 5, 4, 3, 2, 1]:
if (counts[i] >= 4):
return (4 * i)
return 0 | def four_of_a_kind(dice):
counts = dice_counts(dice)
for i in [6, 5, 4, 3, 2, 1]:
if (counts[i] >= 4):
return (4 * i)
return 0<|docstring|>Score the given roll in the 'Four of a kind' category<|endoftext|> |
5ab51604c3262be678b69116bc2eabd184c0feb90bbcd7d2371bf218a19b9d73 | def two_pairs(dice):
"Score the given roll in the 'Two Pairs' category"
counts = dice_counts(dice)
pairs = []
for i in [6, 5, 4, 3, 2, 1]:
if (counts[i] >= 2):
pairs.append(i)
if (len(pairs) == 2):
return ((pairs[0] * 2) + (pairs[1] * 2))
return 0 | Score the given roll in the 'Two Pairs' category | yatzy.py | two_pairs | SGenheden/YatzyGameWithDoctest | 0 | python | def two_pairs(dice):
counts = dice_counts(dice)
pairs = []
for i in [6, 5, 4, 3, 2, 1]:
if (counts[i] >= 2):
pairs.append(i)
if (len(pairs) == 2):
return ((pairs[0] * 2) + (pairs[1] * 2))
return 0 | def two_pairs(dice):
counts = dice_counts(dice)
pairs = []
for i in [6, 5, 4, 3, 2, 1]:
if (counts[i] >= 2):
pairs.append(i)
if (len(pairs) == 2):
return ((pairs[0] * 2) + (pairs[1] * 2))
return 0<|docstring|>Score the given roll in the 'Two Pairs' category<|endoftext|> |
7f28d7b19e96197580ef3ab60787c5afabdc16f6807e6d82852fd2f32292db1a | def full_house(dice):
"Score the given roll in the 'Full House' category "
counts = dice_counts(dice)
if ((2 in counts.values()) and (3 in counts.values())):
return sum(dice)
return 0 | Score the given roll in the 'Full House' category | yatzy.py | full_house | SGenheden/YatzyGameWithDoctest | 0 | python | def full_house(dice):
" "
counts = dice_counts(dice)
if ((2 in counts.values()) and (3 in counts.values())):
return sum(dice)
return 0 | def full_house(dice):
" "
counts = dice_counts(dice)
if ((2 in counts.values()) and (3 in counts.values())):
return sum(dice)
return 0<|docstring|>Score the given roll in the 'Full House' category<|endoftext|> |
0211c4737a58ff7de8a4d436202415d131e8363dba34ea446dcaa8eeabf66c67 | def ones(dice):
"Score the given roll in the 'Ones' category "
return dice_counts(dice)[1] | Score the given roll in the 'Ones' category | yatzy.py | ones | SGenheden/YatzyGameWithDoctest | 0 | python | def ones(dice):
" "
return dice_counts(dice)[1] | def ones(dice):
" "
return dice_counts(dice)[1]<|docstring|>Score the given roll in the 'Ones' category<|endoftext|> |
6cad17ab7ce8cdd5d58378a1a4075094d2046d6e709046eaeb096852582e1368 | def twos(dice):
"Score the given roll in the 'Twos' category "
return (dice_counts(dice)[2] * 2) | Score the given roll in the 'Twos' category | yatzy.py | twos | SGenheden/YatzyGameWithDoctest | 0 | python | def twos(dice):
" "
return (dice_counts(dice)[2] * 2) | def twos(dice):
" "
return (dice_counts(dice)[2] * 2)<|docstring|>Score the given roll in the 'Twos' category<|endoftext|> |
035e4b6e426f3dcfc96eb50caf8bde58de9595eeb4dc429e0598166bbc04fdb9 | def threes(dice):
"Score the given roll in the 'Threes' category "
return (dice_counts(dice)[3] * 3) | Score the given roll in the 'Threes' category | yatzy.py | threes | SGenheden/YatzyGameWithDoctest | 0 | python | def threes(dice):
" "
return (dice_counts(dice)[3] * 3) | def threes(dice):
" "
return (dice_counts(dice)[3] * 3)<|docstring|>Score the given roll in the 'Threes' category<|endoftext|> |
1981c154802d8e56cbb874dec06e2c1136ab375b2485a972875a6d42e8fb4f1f | def fours(dice):
"Score the given roll in the 'Fours' category "
return (dice_counts(dice)[4] * 4) | Score the given roll in the 'Fours' category | yatzy.py | fours | SGenheden/YatzyGameWithDoctest | 0 | python | def fours(dice):
" "
return (dice_counts(dice)[4] * 4) | def fours(dice):
" "
return (dice_counts(dice)[4] * 4)<|docstring|>Score the given roll in the 'Fours' category<|endoftext|> |
be46e2ca7b661f413cbb8cc62475c4a9884dcf8936fff1c7e50afa69b221d654 | def fives(dice):
"Score the given roll in the 'Fives' category "
return (dice_counts(dice)[5] * 5) | Score the given roll in the 'Fives' category | yatzy.py | fives | SGenheden/YatzyGameWithDoctest | 0 | python | def fives(dice):
" "
return (dice_counts(dice)[5] * 5) | def fives(dice):
" "
return (dice_counts(dice)[5] * 5)<|docstring|>Score the given roll in the 'Fives' category<|endoftext|> |
90a9870f6f7300acdb32b1b935fd5870769244b3c3b93a0faca218510c0d75fd | def sixes(dice):
"Score the given roll in the 'Sixes' category "
return (dice_counts(dice)[6] * 6) | Score the given roll in the 'Sixes' category | yatzy.py | sixes | SGenheden/YatzyGameWithDoctest | 0 | python | def sixes(dice):
" "
return (dice_counts(dice)[6] * 6) | def sixes(dice):
" "
return (dice_counts(dice)[6] * 6)<|docstring|>Score the given roll in the 'Sixes' category<|endoftext|> |
8f5e28acc947ef05b0bb68900ef73b429ef1431b28ce328e7b145341271ad32a | def dice_counts(dice):
'Make a dictionary of how many of each value are in the dice '
return {x: dice.count(x) for x in range(1, 7)} | Make a dictionary of how many of each value are in the dice | yatzy.py | dice_counts | SGenheden/YatzyGameWithDoctest | 0 | python | def dice_counts(dice):
' '
return {x: dice.count(x) for x in range(1, 7)} | def dice_counts(dice):
' '
return {x: dice.count(x) for x in range(1, 7)}<|docstring|>Make a dictionary of how many of each value are in the dice<|endoftext|> |
f9f2d9aa18c1676ec2460ac2dfe378c0ac102ead615a2f1d925dfb470684a34b | def scores_in_categories(dice, categories=(yatzy, full_house, four_of_a_kind, three_of_a_kind, two_pairs, small_straight, large_straight, ones, twos, threes, fours, fives, sixes, chance)):
'Score the dice in each category and return those with a non-zero score. '
scores = [(category(dice), category) for category in categories]
return sorted(scores, reverse=True, key=itemgetter(0)) | Score the dice in each category and return those with a non-zero score. | yatzy.py | scores_in_categories | SGenheden/YatzyGameWithDoctest | 0 | python | def scores_in_categories(dice, categories=(yatzy, full_house, four_of_a_kind, three_of_a_kind, two_pairs, small_straight, large_straight, ones, twos, threes, fours, fives, sixes, chance)):
' '
scores = [(category(dice), category) for category in categories]
return sorted(scores, reverse=True, key=itemgetter(0)) | def scores_in_categories(dice, categories=(yatzy, full_house, four_of_a_kind, three_of_a_kind, two_pairs, small_straight, large_straight, ones, twos, threes, fours, fives, sixes, chance)):
' '
scores = [(category(dice), category) for category in categories]
return sorted(scores, reverse=True, key=itemgetter(0))<|docstring|>Score the dice in each category and return those with a non-zero score.<|endoftext|> |
c42571df775d0739c942272a42ab8e8335f8e22638aa6aed4aab9277bc6cd917 | def create(gateway_name, name, resource_group, rule_set_name, enable_reroute=None, modified_path=None, modified_query_string=None, no_wait=None, request_headers=None, response_headers=None, sequence=None):
'\n Create a rewrite rule.\n\n Required Parameters:\n - gateway_name -- Name of the application gateway.\n - name -- Name of the rewrite rule.\n - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`\n - rule_set_name -- Name of the rewrite rule set.\n\n Optional Parameters:\n - enable_reroute -- If set as true, it will re-evaluate the url path map provided in path based request routing rules using modified path.\n - modified_path -- Url path for url rewrite\n - modified_query_string -- Query string for url rewrite.\n - no_wait -- Do not wait for the long-running operation to finish.\n - request_headers -- Space-separated list of HEADER=VALUE pairs.\n - response_headers -- Space-separated list of HEADER=VALUE pairs.\n - sequence -- Determines the execution order of the rule in the rule set.\n '
return _call_az('az network application-gateway rewrite-rule create', locals()) | Create a rewrite rule.
Required Parameters:
- gateway_name -- Name of the application gateway.
- name -- Name of the rewrite rule.
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
- rule_set_name -- Name of the rewrite rule set.
Optional Parameters:
- enable_reroute -- If set as true, it will re-evaluate the url path map provided in path based request routing rules using modified path.
- modified_path -- Url path for url rewrite
- modified_query_string -- Query string for url rewrite.
- no_wait -- Do not wait for the long-running operation to finish.
- request_headers -- Space-separated list of HEADER=VALUE pairs.
- response_headers -- Space-separated list of HEADER=VALUE pairs.
- sequence -- Determines the execution order of the rule in the rule set. | pyaz/network/application_gateway/rewrite_rule/__init__.py | create | py-az-cli/py-az-cli | 0 | python | def create(gateway_name, name, resource_group, rule_set_name, enable_reroute=None, modified_path=None, modified_query_string=None, no_wait=None, request_headers=None, response_headers=None, sequence=None):
'\n Create a rewrite rule.\n\n Required Parameters:\n - gateway_name -- Name of the application gateway.\n - name -- Name of the rewrite rule.\n - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`\n - rule_set_name -- Name of the rewrite rule set.\n\n Optional Parameters:\n - enable_reroute -- If set as true, it will re-evaluate the url path map provided in path based request routing rules using modified path.\n - modified_path -- Url path for url rewrite\n - modified_query_string -- Query string for url rewrite.\n - no_wait -- Do not wait for the long-running operation to finish.\n - request_headers -- Space-separated list of HEADER=VALUE pairs.\n - response_headers -- Space-separated list of HEADER=VALUE pairs.\n - sequence -- Determines the execution order of the rule in the rule set.\n '
return _call_az('az network application-gateway rewrite-rule create', locals()) | def create(gateway_name, name, resource_group, rule_set_name, enable_reroute=None, modified_path=None, modified_query_string=None, no_wait=None, request_headers=None, response_headers=None, sequence=None):
'\n Create a rewrite rule.\n\n Required Parameters:\n - gateway_name -- Name of the application gateway.\n - name -- Name of the rewrite rule.\n - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`\n - rule_set_name -- Name of the rewrite rule set.\n\n Optional Parameters:\n - enable_reroute -- If set as true, it will re-evaluate the url path map provided in path based request routing rules using modified path.\n - modified_path -- Url path for url rewrite\n - modified_query_string -- Query string for url rewrite.\n - no_wait -- Do not wait for the long-running operation to finish.\n - request_headers -- Space-separated list of HEADER=VALUE pairs.\n - response_headers -- Space-separated list of HEADER=VALUE pairs.\n - sequence -- Determines the execution order of the rule in the rule set.\n '
return _call_az('az network application-gateway rewrite-rule create', locals())<|docstring|>Create a rewrite rule.
Required Parameters:
- gateway_name -- Name of the application gateway.
- name -- Name of the rewrite rule.
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
- rule_set_name -- Name of the rewrite rule set.
Optional Parameters:
- enable_reroute -- If set as true, it will re-evaluate the url path map provided in path based request routing rules using modified path.
- modified_path -- Url path for url rewrite
- modified_query_string -- Query string for url rewrite.
- no_wait -- Do not wait for the long-running operation to finish.
- request_headers -- Space-separated list of HEADER=VALUE pairs.
- response_headers -- Space-separated list of HEADER=VALUE pairs.
- sequence -- Determines the execution order of the rule in the rule set.<|endoftext|> |
ccf04d674d6f88b6bc2adc12dc565dec9bc48dced0169ae7f58f9b7fab762588 | def show(gateway_name, name, resource_group, rule_set_name):
'\n Get the details of a rewrite rule.\n\n Required Parameters:\n - gateway_name -- Name of the application gateway.\n - name -- Name of the rewrite rule.\n - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`\n - rule_set_name -- Name of the rewrite rule set.\n '
return _call_az('az network application-gateway rewrite-rule show', locals()) | Get the details of a rewrite rule.
Required Parameters:
- gateway_name -- Name of the application gateway.
- name -- Name of the rewrite rule.
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
- rule_set_name -- Name of the rewrite rule set. | pyaz/network/application_gateway/rewrite_rule/__init__.py | show | py-az-cli/py-az-cli | 0 | python | def show(gateway_name, name, resource_group, rule_set_name):
'\n Get the details of a rewrite rule.\n\n Required Parameters:\n - gateway_name -- Name of the application gateway.\n - name -- Name of the rewrite rule.\n - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`\n - rule_set_name -- Name of the rewrite rule set.\n '
return _call_az('az network application-gateway rewrite-rule show', locals()) | def show(gateway_name, name, resource_group, rule_set_name):
'\n Get the details of a rewrite rule.\n\n Required Parameters:\n - gateway_name -- Name of the application gateway.\n - name -- Name of the rewrite rule.\n - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`\n - rule_set_name -- Name of the rewrite rule set.\n '
return _call_az('az network application-gateway rewrite-rule show', locals())<|docstring|>Get the details of a rewrite rule.
Required Parameters:
- gateway_name -- Name of the application gateway.
- name -- Name of the rewrite rule.
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
- rule_set_name -- Name of the rewrite rule set.<|endoftext|> |
49c2145b5f04714f7b1cf8c25bfae6152c2c339f9dcfc19f579654b3d5c3a467 | def list(gateway_name, resource_group, rule_set_name):
'\n List rewrite rules.\n\n Required Parameters:\n - gateway_name -- Name of the application gateway.\n - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`\n - rule_set_name -- Name of the rewrite rule set.\n '
return _call_az('az network application-gateway rewrite-rule list', locals()) | List rewrite rules.
Required Parameters:
- gateway_name -- Name of the application gateway.
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
- rule_set_name -- Name of the rewrite rule set. | pyaz/network/application_gateway/rewrite_rule/__init__.py | list | py-az-cli/py-az-cli | 0 | python | def list(gateway_name, resource_group, rule_set_name):
'\n List rewrite rules.\n\n Required Parameters:\n - gateway_name -- Name of the application gateway.\n - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`\n - rule_set_name -- Name of the rewrite rule set.\n '
return _call_az('az network application-gateway rewrite-rule list', locals()) | def list(gateway_name, resource_group, rule_set_name):
'\n List rewrite rules.\n\n Required Parameters:\n - gateway_name -- Name of the application gateway.\n - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`\n - rule_set_name -- Name of the rewrite rule set.\n '
return _call_az('az network application-gateway rewrite-rule list', locals())<|docstring|>List rewrite rules.
Required Parameters:
- gateway_name -- Name of the application gateway.
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
- rule_set_name -- Name of the rewrite rule set.<|endoftext|> |
92bb9cf6360a6c2b7456744ef623b858a3bd507a4370db8b976a66c30cd014ed | def delete(gateway_name, name, resource_group, rule_set_name, no_wait=None):
'\n Delete a rewrite rule.\n\n Required Parameters:\n - gateway_name -- Name of the application gateway.\n - name -- Name of the rewrite rule.\n - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`\n - rule_set_name -- Name of the rewrite rule set.\n\n Optional Parameters:\n - no_wait -- Do not wait for the long-running operation to finish.\n '
return _call_az('az network application-gateway rewrite-rule delete', locals()) | Delete a rewrite rule.
Required Parameters:
- gateway_name -- Name of the application gateway.
- name -- Name of the rewrite rule.
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
- rule_set_name -- Name of the rewrite rule set.
Optional Parameters:
- no_wait -- Do not wait for the long-running operation to finish. | pyaz/network/application_gateway/rewrite_rule/__init__.py | delete | py-az-cli/py-az-cli | 0 | python | def delete(gateway_name, name, resource_group, rule_set_name, no_wait=None):
'\n Delete a rewrite rule.\n\n Required Parameters:\n - gateway_name -- Name of the application gateway.\n - name -- Name of the rewrite rule.\n - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`\n - rule_set_name -- Name of the rewrite rule set.\n\n Optional Parameters:\n - no_wait -- Do not wait for the long-running operation to finish.\n '
return _call_az('az network application-gateway rewrite-rule delete', locals()) | def delete(gateway_name, name, resource_group, rule_set_name, no_wait=None):
'\n Delete a rewrite rule.\n\n Required Parameters:\n - gateway_name -- Name of the application gateway.\n - name -- Name of the rewrite rule.\n - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`\n - rule_set_name -- Name of the rewrite rule set.\n\n Optional Parameters:\n - no_wait -- Do not wait for the long-running operation to finish.\n '
return _call_az('az network application-gateway rewrite-rule delete', locals())<|docstring|>Delete a rewrite rule.
Required Parameters:
- gateway_name -- Name of the application gateway.
- name -- Name of the rewrite rule.
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
- rule_set_name -- Name of the rewrite rule set.
Optional Parameters:
- no_wait -- Do not wait for the long-running operation to finish.<|endoftext|> |
da9e4b2361ae65f1759fb91e1def1bb3b0bc97871a16aa67b1653068b7b07777 | def update(gateway_name, name, resource_group, rule_set_name, add=None, enable_reroute=None, force_string=None, modified_path=None, modified_query_string=None, no_wait=None, remove=None, request_headers=None, response_headers=None, sequence=None, set=None):
"\n Update a rewrite rule.\n\n Required Parameters:\n - gateway_name -- Name of the application gateway.\n - name -- Name of the rewrite rule.\n - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`\n - rule_set_name -- Name of the rewrite rule set.\n\n Optional Parameters:\n - add -- Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>\n - enable_reroute -- If set as true, it will re-evaluate the url path map provided in path based request routing rules using modified path.\n - force_string -- When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.\n - modified_path -- Url path for url rewrite\n - modified_query_string -- Query string for url rewrite.\n - no_wait -- Do not wait for the long-running operation to finish.\n - remove -- Remove a property or an element from a list. Example: --remove property.list <indexToRemove> OR --remove propertyToRemove\n - request_headers -- Space-separated list of HEADER=VALUE pairs.\n - response_headers -- Space-separated list of HEADER=VALUE pairs.\n - sequence -- Determines the execution order of the rule in the rule set.\n - set -- Update an object by specifying a property path and value to set. Example: --set property1.property2=<value>\n "
return _call_az('az network application-gateway rewrite-rule update', locals()) | Update a rewrite rule.
Required Parameters:
- gateway_name -- Name of the application gateway.
- name -- Name of the rewrite rule.
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
- rule_set_name -- Name of the rewrite rule set.
Optional Parameters:
- add -- Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>
- enable_reroute -- If set as true, it will re-evaluate the url path map provided in path based request routing rules using modified path.
- force_string -- When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.
- modified_path -- Url path for url rewrite
- modified_query_string -- Query string for url rewrite.
- no_wait -- Do not wait for the long-running operation to finish.
- remove -- Remove a property or an element from a list. Example: --remove property.list <indexToRemove> OR --remove propertyToRemove
- request_headers -- Space-separated list of HEADER=VALUE pairs.
- response_headers -- Space-separated list of HEADER=VALUE pairs.
- sequence -- Determines the execution order of the rule in the rule set.
- set -- Update an object by specifying a property path and value to set. Example: --set property1.property2=<value> | pyaz/network/application_gateway/rewrite_rule/__init__.py | update | py-az-cli/py-az-cli | 0 | python | def update(gateway_name, name, resource_group, rule_set_name, add=None, enable_reroute=None, force_string=None, modified_path=None, modified_query_string=None, no_wait=None, remove=None, request_headers=None, response_headers=None, sequence=None, set=None):
"\n Update a rewrite rule.\n\n Required Parameters:\n - gateway_name -- Name of the application gateway.\n - name -- Name of the rewrite rule.\n - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`\n - rule_set_name -- Name of the rewrite rule set.\n\n Optional Parameters:\n - add -- Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>\n - enable_reroute -- If set as true, it will re-evaluate the url path map provided in path based request routing rules using modified path.\n - force_string -- When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.\n - modified_path -- Url path for url rewrite\n - modified_query_string -- Query string for url rewrite.\n - no_wait -- Do not wait for the long-running operation to finish.\n - remove -- Remove a property or an element from a list. Example: --remove property.list <indexToRemove> OR --remove propertyToRemove\n - request_headers -- Space-separated list of HEADER=VALUE pairs.\n - response_headers -- Space-separated list of HEADER=VALUE pairs.\n - sequence -- Determines the execution order of the rule in the rule set.\n - set -- Update an object by specifying a property path and value to set. Example: --set property1.property2=<value>\n "
return _call_az('az network application-gateway rewrite-rule update', locals()) | def update(gateway_name, name, resource_group, rule_set_name, add=None, enable_reroute=None, force_string=None, modified_path=None, modified_query_string=None, no_wait=None, remove=None, request_headers=None, response_headers=None, sequence=None, set=None):
"\n Update a rewrite rule.\n\n Required Parameters:\n - gateway_name -- Name of the application gateway.\n - name -- Name of the rewrite rule.\n - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`\n - rule_set_name -- Name of the rewrite rule set.\n\n Optional Parameters:\n - add -- Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>\n - enable_reroute -- If set as true, it will re-evaluate the url path map provided in path based request routing rules using modified path.\n - force_string -- When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.\n - modified_path -- Url path for url rewrite\n - modified_query_string -- Query string for url rewrite.\n - no_wait -- Do not wait for the long-running operation to finish.\n - remove -- Remove a property or an element from a list. Example: --remove property.list <indexToRemove> OR --remove propertyToRemove\n - request_headers -- Space-separated list of HEADER=VALUE pairs.\n - response_headers -- Space-separated list of HEADER=VALUE pairs.\n - sequence -- Determines the execution order of the rule in the rule set.\n - set -- Update an object by specifying a property path and value to set. Example: --set property1.property2=<value>\n "
return _call_az('az network application-gateway rewrite-rule update', locals())<|docstring|>Update a rewrite rule.
Required Parameters:
- gateway_name -- Name of the application gateway.
- name -- Name of the rewrite rule.
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
- rule_set_name -- Name of the rewrite rule set.
Optional Parameters:
- add -- Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>
- enable_reroute -- If set as true, it will re-evaluate the url path map provided in path based request routing rules using modified path.
- force_string -- When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.
- modified_path -- Url path for url rewrite
- modified_query_string -- Query string for url rewrite.
- no_wait -- Do not wait for the long-running operation to finish.
- remove -- Remove a property or an element from a list. Example: --remove property.list <indexToRemove> OR --remove propertyToRemove
- request_headers -- Space-separated list of HEADER=VALUE pairs.
- response_headers -- Space-separated list of HEADER=VALUE pairs.
- sequence -- Determines the execution order of the rule in the rule set.
- set -- Update an object by specifying a property path and value to set. Example: --set property1.property2=<value><|endoftext|> |
33393d53667014b5c0e1e2e48a9730c4a406be46196960a190a333c4c2ee3768 | def __init__(self, config):
'\n :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration`\n :param config: Configuration to be used for creating the stub.\n '
VapiInterface.__init__(self, config, _BfdPeersStub)
self._VAPI_OPERATION_IDS = {} | :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
:param config: Configuration to be used for creating the stub. | com/vmware/nsx/logical_routers/routing/static_routes_client.py | __init__ | adammillerio/vsphere-automation-sdk-python | 0 | python | def __init__(self, config):
'\n :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration`\n :param config: Configuration to be used for creating the stub.\n '
VapiInterface.__init__(self, config, _BfdPeersStub)
self._VAPI_OPERATION_IDS = {} | def __init__(self, config):
'\n :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration`\n :param config: Configuration to be used for creating the stub.\n '
VapiInterface.__init__(self, config, _BfdPeersStub)
self._VAPI_OPERATION_IDS = {}<|docstring|>:type config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
:param config: Configuration to be used for creating the stub.<|endoftext|> |
edb0c1d5f144813fcba962400cbe8f657c35c73c7b1c73eb58cc62d3de353585 | def create(self, logical_router_id, static_hop_bfd_peer):
'\n Creates a BFD peer for static route. The required parameters includes\n peer IP address.\n\n :type logical_router_id: :class:`str`\n :param logical_router_id: (required)\n :type static_hop_bfd_peer: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`\n :param static_hop_bfd_peer: (required)\n :rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`\n :return: com.vmware.nsx.model.StaticHopBfdPeer\n :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` \n Service Unavailable\n :raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest` \n Bad Request, Precondition Failed\n :raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError` \n Internal Server Error\n :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` \n Forbidden\n :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` \n Not Found\n '
return self._invoke('create', {'logical_router_id': logical_router_id, 'static_hop_bfd_peer': static_hop_bfd_peer}) | Creates a BFD peer for static route. The required parameters includes
peer IP address.
:type logical_router_id: :class:`str`
:param logical_router_id: (required)
:type static_hop_bfd_peer: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`
:param static_hop_bfd_peer: (required)
:rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`
:return: com.vmware.nsx.model.StaticHopBfdPeer
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
Service Unavailable
:raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest`
Bad Request, Precondition Failed
:raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError`
Internal Server Error
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
Forbidden
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
Not Found | com/vmware/nsx/logical_routers/routing/static_routes_client.py | create | adammillerio/vsphere-automation-sdk-python | 0 | python | def create(self, logical_router_id, static_hop_bfd_peer):
'\n Creates a BFD peer for static route. The required parameters includes\n peer IP address.\n\n :type logical_router_id: :class:`str`\n :param logical_router_id: (required)\n :type static_hop_bfd_peer: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`\n :param static_hop_bfd_peer: (required)\n :rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`\n :return: com.vmware.nsx.model.StaticHopBfdPeer\n :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` \n Service Unavailable\n :raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest` \n Bad Request, Precondition Failed\n :raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError` \n Internal Server Error\n :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` \n Forbidden\n :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` \n Not Found\n '
return self._invoke('create', {'logical_router_id': logical_router_id, 'static_hop_bfd_peer': static_hop_bfd_peer}) | def create(self, logical_router_id, static_hop_bfd_peer):
'\n Creates a BFD peer for static route. The required parameters includes\n peer IP address.\n\n :type logical_router_id: :class:`str`\n :param logical_router_id: (required)\n :type static_hop_bfd_peer: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`\n :param static_hop_bfd_peer: (required)\n :rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`\n :return: com.vmware.nsx.model.StaticHopBfdPeer\n :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` \n Service Unavailable\n :raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest` \n Bad Request, Precondition Failed\n :raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError` \n Internal Server Error\n :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` \n Forbidden\n :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` \n Not Found\n '
return self._invoke('create', {'logical_router_id': logical_router_id, 'static_hop_bfd_peer': static_hop_bfd_peer})<|docstring|>Creates a BFD peer for static route. The required parameters includes
peer IP address.
:type logical_router_id: :class:`str`
:param logical_router_id: (required)
:type static_hop_bfd_peer: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`
:param static_hop_bfd_peer: (required)
:rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`
:return: com.vmware.nsx.model.StaticHopBfdPeer
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
Service Unavailable
:raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest`
Bad Request, Precondition Failed
:raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError`
Internal Server Error
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
Forbidden
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
Not Found<|endoftext|> |
1a733ceae5966de9081965ec9a7482f8b5cf397c00c0ab4371b48028406212d5 | def delete(self, logical_router_id, bfd_peer_id, force=None):
'\n Deletes the specified BFD peer present on specified logical router.\n\n :type logical_router_id: :class:`str`\n :param logical_router_id: (required)\n :type bfd_peer_id: :class:`str`\n :param bfd_peer_id: (required)\n :type force: :class:`bool` or ``None``\n :param force: Force delete the resource even if it is being used somewhere\n (optional, default to false)\n :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` \n Service Unavailable\n :raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest` \n Bad Request, Precondition Failed\n :raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError` \n Internal Server Error\n :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` \n Forbidden\n :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` \n Not Found\n '
return self._invoke('delete', {'logical_router_id': logical_router_id, 'bfd_peer_id': bfd_peer_id, 'force': force}) | Deletes the specified BFD peer present on specified logical router.
:type logical_router_id: :class:`str`
:param logical_router_id: (required)
:type bfd_peer_id: :class:`str`
:param bfd_peer_id: (required)
:type force: :class:`bool` or ``None``
:param force: Force delete the resource even if it is being used somewhere
(optional, default to false)
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
Service Unavailable
:raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest`
Bad Request, Precondition Failed
:raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError`
Internal Server Error
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
Forbidden
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
Not Found | com/vmware/nsx/logical_routers/routing/static_routes_client.py | delete | adammillerio/vsphere-automation-sdk-python | 0 | python | def delete(self, logical_router_id, bfd_peer_id, force=None):
'\n Deletes the specified BFD peer present on specified logical router.\n\n :type logical_router_id: :class:`str`\n :param logical_router_id: (required)\n :type bfd_peer_id: :class:`str`\n :param bfd_peer_id: (required)\n :type force: :class:`bool` or ``None``\n :param force: Force delete the resource even if it is being used somewhere\n (optional, default to false)\n :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` \n Service Unavailable\n :raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest` \n Bad Request, Precondition Failed\n :raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError` \n Internal Server Error\n :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` \n Forbidden\n :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` \n Not Found\n '
return self._invoke('delete', {'logical_router_id': logical_router_id, 'bfd_peer_id': bfd_peer_id, 'force': force}) | def delete(self, logical_router_id, bfd_peer_id, force=None):
'\n Deletes the specified BFD peer present on specified logical router.\n\n :type logical_router_id: :class:`str`\n :param logical_router_id: (required)\n :type bfd_peer_id: :class:`str`\n :param bfd_peer_id: (required)\n :type force: :class:`bool` or ``None``\n :param force: Force delete the resource even if it is being used somewhere\n (optional, default to false)\n :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` \n Service Unavailable\n :raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest` \n Bad Request, Precondition Failed\n :raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError` \n Internal Server Error\n :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` \n Forbidden\n :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` \n Not Found\n '
return self._invoke('delete', {'logical_router_id': logical_router_id, 'bfd_peer_id': bfd_peer_id, 'force': force})<|docstring|>Deletes the specified BFD peer present on specified logical router.
:type logical_router_id: :class:`str`
:param logical_router_id: (required)
:type bfd_peer_id: :class:`str`
:param bfd_peer_id: (required)
:type force: :class:`bool` or ``None``
:param force: Force delete the resource even if it is being used somewhere
(optional, default to false)
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
Service Unavailable
:raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest`
Bad Request, Precondition Failed
:raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError`
Internal Server Error
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
Forbidden
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
Not Found<|endoftext|> |
358cc232da885c7388ca02bc097479de37c600a95d8ebb3cf1271e78c185a777 | def get(self, logical_router_id, bfd_peer_id):
'\n Read the BFD peer having specified ID.\n\n :type logical_router_id: :class:`str`\n :param logical_router_id: (required)\n :type bfd_peer_id: :class:`str`\n :param bfd_peer_id: (required)\n :rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`\n :return: com.vmware.nsx.model.StaticHopBfdPeer\n :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` \n Service Unavailable\n :raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest` \n Bad Request, Precondition Failed\n :raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError` \n Internal Server Error\n :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` \n Forbidden\n :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` \n Not Found\n '
return self._invoke('get', {'logical_router_id': logical_router_id, 'bfd_peer_id': bfd_peer_id}) | Read the BFD peer having specified ID.
:type logical_router_id: :class:`str`
:param logical_router_id: (required)
:type bfd_peer_id: :class:`str`
:param bfd_peer_id: (required)
:rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`
:return: com.vmware.nsx.model.StaticHopBfdPeer
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
Service Unavailable
:raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest`
Bad Request, Precondition Failed
:raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError`
Internal Server Error
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
Forbidden
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
Not Found | com/vmware/nsx/logical_routers/routing/static_routes_client.py | get | adammillerio/vsphere-automation-sdk-python | 0 | python | def get(self, logical_router_id, bfd_peer_id):
'\n Read the BFD peer having specified ID.\n\n :type logical_router_id: :class:`str`\n :param logical_router_id: (required)\n :type bfd_peer_id: :class:`str`\n :param bfd_peer_id: (required)\n :rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`\n :return: com.vmware.nsx.model.StaticHopBfdPeer\n :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` \n Service Unavailable\n :raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest` \n Bad Request, Precondition Failed\n :raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError` \n Internal Server Error\n :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` \n Forbidden\n :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` \n Not Found\n '
return self._invoke('get', {'logical_router_id': logical_router_id, 'bfd_peer_id': bfd_peer_id}) | def get(self, logical_router_id, bfd_peer_id):
'\n Read the BFD peer having specified ID.\n\n :type logical_router_id: :class:`str`\n :param logical_router_id: (required)\n :type bfd_peer_id: :class:`str`\n :param bfd_peer_id: (required)\n :rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`\n :return: com.vmware.nsx.model.StaticHopBfdPeer\n :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` \n Service Unavailable\n :raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest` \n Bad Request, Precondition Failed\n :raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError` \n Internal Server Error\n :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` \n Forbidden\n :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` \n Not Found\n '
return self._invoke('get', {'logical_router_id': logical_router_id, 'bfd_peer_id': bfd_peer_id})<|docstring|>Read the BFD peer having specified ID.
:type logical_router_id: :class:`str`
:param logical_router_id: (required)
:type bfd_peer_id: :class:`str`
:param bfd_peer_id: (required)
:rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`
:return: com.vmware.nsx.model.StaticHopBfdPeer
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
Service Unavailable
:raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest`
Bad Request, Precondition Failed
:raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError`
Internal Server Error
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
Forbidden
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
Not Found<|endoftext|> |
576b3ce8ae479c1f48adcc251d0c1fe3d70b337428af33913df62d0a79e5a5b0 | def list(self, logical_router_id, cursor=None, included_fields=None, page_size=None, sort_ascending=None, sort_by=None):
'\n Returns information about all BFD peers created on specified logical\n router for static routes.\n\n :type logical_router_id: :class:`str`\n :param logical_router_id: (required)\n :type cursor: :class:`str` or ``None``\n :param cursor: Opaque cursor to be used for getting next page of records (supplied\n by current result page) (optional)\n :type included_fields: :class:`str` or ``None``\n :param included_fields: Comma separated list of fields that should be included in query\n result (optional)\n :type page_size: :class:`long` or ``None``\n :param page_size: Maximum number of results to return in this page (server may return\n fewer) (optional, default to 1000)\n :type sort_ascending: :class:`bool` or ``None``\n :param sort_ascending: (optional)\n :type sort_by: :class:`str` or ``None``\n :param sort_by: Field by which records are sorted (optional)\n :rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeerListResult`\n :return: com.vmware.nsx.model.StaticHopBfdPeerListResult\n :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` \n Service Unavailable\n :raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest` \n Bad Request, Precondition Failed\n :raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError` \n Internal Server Error\n :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` \n Forbidden\n :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` \n Not Found\n '
return self._invoke('list', {'logical_router_id': logical_router_id, 'cursor': cursor, 'included_fields': included_fields, 'page_size': page_size, 'sort_ascending': sort_ascending, 'sort_by': sort_by}) | Returns information about all BFD peers created on specified logical
router for static routes.
:type logical_router_id: :class:`str`
:param logical_router_id: (required)
:type cursor: :class:`str` or ``None``
:param cursor: Opaque cursor to be used for getting next page of records (supplied
by current result page) (optional)
:type included_fields: :class:`str` or ``None``
:param included_fields: Comma separated list of fields that should be included in query
result (optional)
:type page_size: :class:`long` or ``None``
:param page_size: Maximum number of results to return in this page (server may return
fewer) (optional, default to 1000)
:type sort_ascending: :class:`bool` or ``None``
:param sort_ascending: (optional)
:type sort_by: :class:`str` or ``None``
:param sort_by: Field by which records are sorted (optional)
:rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeerListResult`
:return: com.vmware.nsx.model.StaticHopBfdPeerListResult
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
Service Unavailable
:raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest`
Bad Request, Precondition Failed
:raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError`
Internal Server Error
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
Forbidden
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
Not Found | com/vmware/nsx/logical_routers/routing/static_routes_client.py | list | adammillerio/vsphere-automation-sdk-python | 0 | python | def list(self, logical_router_id, cursor=None, included_fields=None, page_size=None, sort_ascending=None, sort_by=None):
'\n Returns information about all BFD peers created on specified logical\n router for static routes.\n\n :type logical_router_id: :class:`str`\n :param logical_router_id: (required)\n :type cursor: :class:`str` or ``None``\n :param cursor: Opaque cursor to be used for getting next page of records (supplied\n by current result page) (optional)\n :type included_fields: :class:`str` or ``None``\n :param included_fields: Comma separated list of fields that should be included in query\n result (optional)\n :type page_size: :class:`long` or ``None``\n :param page_size: Maximum number of results to return in this page (server may return\n fewer) (optional, default to 1000)\n :type sort_ascending: :class:`bool` or ``None``\n :param sort_ascending: (optional)\n :type sort_by: :class:`str` or ``None``\n :param sort_by: Field by which records are sorted (optional)\n :rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeerListResult`\n :return: com.vmware.nsx.model.StaticHopBfdPeerListResult\n :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` \n Service Unavailable\n :raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest` \n Bad Request, Precondition Failed\n :raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError` \n Internal Server Error\n :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` \n Forbidden\n :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` \n Not Found\n '
return self._invoke('list', {'logical_router_id': logical_router_id, 'cursor': cursor, 'included_fields': included_fields, 'page_size': page_size, 'sort_ascending': sort_ascending, 'sort_by': sort_by}) | def list(self, logical_router_id, cursor=None, included_fields=None, page_size=None, sort_ascending=None, sort_by=None):
'\n Returns information about all BFD peers created on specified logical\n router for static routes.\n\n :type logical_router_id: :class:`str`\n :param logical_router_id: (required)\n :type cursor: :class:`str` or ``None``\n :param cursor: Opaque cursor to be used for getting next page of records (supplied\n by current result page) (optional)\n :type included_fields: :class:`str` or ``None``\n :param included_fields: Comma separated list of fields that should be included in query\n result (optional)\n :type page_size: :class:`long` or ``None``\n :param page_size: Maximum number of results to return in this page (server may return\n fewer) (optional, default to 1000)\n :type sort_ascending: :class:`bool` or ``None``\n :param sort_ascending: (optional)\n :type sort_by: :class:`str` or ``None``\n :param sort_by: Field by which records are sorted (optional)\n :rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeerListResult`\n :return: com.vmware.nsx.model.StaticHopBfdPeerListResult\n :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` \n Service Unavailable\n :raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest` \n Bad Request, Precondition Failed\n :raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError` \n Internal Server Error\n :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` \n Forbidden\n :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` \n Not Found\n '
return self._invoke('list', {'logical_router_id': logical_router_id, 'cursor': cursor, 'included_fields': included_fields, 'page_size': page_size, 'sort_ascending': sort_ascending, 'sort_by': sort_by})<|docstring|>Returns information about all BFD peers created on specified logical
router for static routes.
:type logical_router_id: :class:`str`
:param logical_router_id: (required)
:type cursor: :class:`str` or ``None``
:param cursor: Opaque cursor to be used for getting next page of records (supplied
by current result page) (optional)
:type included_fields: :class:`str` or ``None``
:param included_fields: Comma separated list of fields that should be included in query
result (optional)
:type page_size: :class:`long` or ``None``
:param page_size: Maximum number of results to return in this page (server may return
fewer) (optional, default to 1000)
:type sort_ascending: :class:`bool` or ``None``
:param sort_ascending: (optional)
:type sort_by: :class:`str` or ``None``
:param sort_by: Field by which records are sorted (optional)
:rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeerListResult`
:return: com.vmware.nsx.model.StaticHopBfdPeerListResult
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
Service Unavailable
:raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest`
Bad Request, Precondition Failed
:raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError`
Internal Server Error
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
Forbidden
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
Not Found<|endoftext|> |
6e0938d923152c308c4e46517e32fd392d8d72d3cbb427b15b24bc8a5946eced | def update(self, logical_router_id, bfd_peer_id, static_hop_bfd_peer):
'\n Modifies the static route BFD peer. Modifiable parameters includes peer\n IP, enable flag and configuration of the BFD peer.\n\n :type logical_router_id: :class:`str`\n :param logical_router_id: (required)\n :type bfd_peer_id: :class:`str`\n :param bfd_peer_id: (required)\n :type static_hop_bfd_peer: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`\n :param static_hop_bfd_peer: (required)\n :rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`\n :return: com.vmware.nsx.model.StaticHopBfdPeer\n :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` \n Service Unavailable\n :raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest` \n Bad Request, Precondition Failed\n :raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError` \n Internal Server Error\n :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` \n Forbidden\n :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` \n Not Found\n '
return self._invoke('update', {'logical_router_id': logical_router_id, 'bfd_peer_id': bfd_peer_id, 'static_hop_bfd_peer': static_hop_bfd_peer}) | Modifies the static route BFD peer. Modifiable parameters includes peer
IP, enable flag and configuration of the BFD peer.
:type logical_router_id: :class:`str`
:param logical_router_id: (required)
:type bfd_peer_id: :class:`str`
:param bfd_peer_id: (required)
:type static_hop_bfd_peer: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`
:param static_hop_bfd_peer: (required)
:rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`
:return: com.vmware.nsx.model.StaticHopBfdPeer
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
Service Unavailable
:raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest`
Bad Request, Precondition Failed
:raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError`
Internal Server Error
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
Forbidden
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
Not Found | com/vmware/nsx/logical_routers/routing/static_routes_client.py | update | adammillerio/vsphere-automation-sdk-python | 0 | python | def update(self, logical_router_id, bfd_peer_id, static_hop_bfd_peer):
'\n Modifies the static route BFD peer. Modifiable parameters includes peer\n IP, enable flag and configuration of the BFD peer.\n\n :type logical_router_id: :class:`str`\n :param logical_router_id: (required)\n :type bfd_peer_id: :class:`str`\n :param bfd_peer_id: (required)\n :type static_hop_bfd_peer: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`\n :param static_hop_bfd_peer: (required)\n :rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`\n :return: com.vmware.nsx.model.StaticHopBfdPeer\n :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` \n Service Unavailable\n :raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest` \n Bad Request, Precondition Failed\n :raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError` \n Internal Server Error\n :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` \n Forbidden\n :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` \n Not Found\n '
return self._invoke('update', {'logical_router_id': logical_router_id, 'bfd_peer_id': bfd_peer_id, 'static_hop_bfd_peer': static_hop_bfd_peer}) | def update(self, logical_router_id, bfd_peer_id, static_hop_bfd_peer):
'\n Modifies the static route BFD peer. Modifiable parameters includes peer\n IP, enable flag and configuration of the BFD peer.\n\n :type logical_router_id: :class:`str`\n :param logical_router_id: (required)\n :type bfd_peer_id: :class:`str`\n :param bfd_peer_id: (required)\n :type static_hop_bfd_peer: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`\n :param static_hop_bfd_peer: (required)\n :rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`\n :return: com.vmware.nsx.model.StaticHopBfdPeer\n :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` \n Service Unavailable\n :raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest` \n Bad Request, Precondition Failed\n :raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError` \n Internal Server Error\n :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` \n Forbidden\n :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` \n Not Found\n '
return self._invoke('update', {'logical_router_id': logical_router_id, 'bfd_peer_id': bfd_peer_id, 'static_hop_bfd_peer': static_hop_bfd_peer})<|docstring|>Modifies the static route BFD peer. Modifiable parameters includes peer
IP, enable flag and configuration of the BFD peer.
:type logical_router_id: :class:`str`
:param logical_router_id: (required)
:type bfd_peer_id: :class:`str`
:param bfd_peer_id: (required)
:type static_hop_bfd_peer: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`
:param static_hop_bfd_peer: (required)
:rtype: :class:`com.vmware.nsx.model_client.StaticHopBfdPeer`
:return: com.vmware.nsx.model.StaticHopBfdPeer
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
Service Unavailable
:raise: :class:`com.vmware.vapi.std.errors_client.InvalidRequest`
Bad Request, Precondition Failed
:raise: :class:`com.vmware.vapi.std.errors_client.InternalServerError`
Internal Server Error
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
Forbidden
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
Not Found<|endoftext|> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.