@@ -232,7 +232,7 @@ def get_category(self, key:Union[str, UserStreamId]):
232232 def get_tag (self , key :Union [str , UserStreamId ]) -> 'UserTag' :
233233 """
234234 :param key: the id of the tag (e.g. "recipes"), or stream ID object
235- :return: the category
235+ :return: the tag
236236 """
237237 if isinstance (key , str ):
238238 id_ = UserStreamId (parts = [STREAM_SOURCE_USER , self .id , 'tag' , key ])
@@ -244,7 +244,7 @@ def get_tag(self, key:Union[str, UserStreamId]) -> 'UserTag':
244244 def get_enterprise_category (self , key :Union [str , EnterpriseStreamId ]) -> 'EnterpriseCategory' :
245245 """
246246 :param key: the UUID of the category (dash separated hex numbers), or a stream ID object)
247- :return: the category
247+ :return: the enterprise category
248248 """
249249 if isinstance (key , str ):
250250 id_ = EnterpriseStreamId (parts = [STREAM_SOURCE_ENTERPRISE , self .enterprise_name , 'category' , key ])
@@ -256,7 +256,7 @@ def get_enterprise_category(self, key:Union[str, EnterpriseStreamId]) -> 'Enterp
256256 def get_enterprise_tag (self , key :Union [str , EnterpriseStreamId ]) -> 'EnterpriseTag' :
257257 """
258258 :param key: the UUID of the tag (dash separated hex numbers), or a stream ID object)
259- :return: the category
259+ :return: the enterprise tag
260260 """
261261 if isinstance (key , str ):
262262 id_ = EnterpriseStreamId (parts = [STREAM_SOURCE_ENTERPRISE , self .enterprise_name , 'tag' , key ])
@@ -275,27 +275,27 @@ def create_enterprise_tag(self, data: Dict[str, Any]) -> 'EnterpriseTag':
275275 return EnterpriseTag (items [0 ], self ._client )
276276
277277 def delete_annotations (self , streamable : Streamable , options : StreamOptions = None ):
278- '''
278+ """
279279 *** WARNING *** Non-reversible operation
280280 Given a streamable, remove all annotations made by the user (identified with self['id'])
281281 :param streamable:
282282 :param options:
283283 :return:
284- '''
284+ """
285285 for a in streamable .stream_contents (options ):
286286 if 'annotations' in a .json :
287287 for annotation in a .json ['annotations' ]:
288288 if self ['id' ] == annotation ['author' ]:
289289 self ._client .do_api_request (f"v3/annotations/{ quote_plus (annotation ['id' ])} " , method = 'DELETE' )
290290
291291 def delete_tags (self , streamable : Streamable , options : StreamOptions = None ):
292- '''
292+ """
293293 *** WARNING *** Non-reversible operation
294294 Given a streamable, remove all tags made by the user (identified with self['id'])
295295 :param streamable:
296296 :param options:
297297 :return:
298- '''
298+ """
299299 a_ids = []
300300 for a in streamable .stream_contents (options ):
301301 if 'tags' in a .json :
@@ -310,9 +310,9 @@ def delete_tags(self, streamable: Streamable, options: StreamOptions = None):
310310 if tagged_by_user == self ['id' ]:
311311 a_ids += [a ["id" ]]
312312 while len (a_ids )> 0 :
313- print ( len ( a_ids ))
314- to_delete = a_ids [:10 ]
315- a_ids = a_ids [10 :]
313+ batch_size = 10 # limitation due to the url length: articles are "de-tagged" by batch of 10.
314+ to_delete = a_ids [:batch_size ]
315+ a_ids = a_ids [batch_size :]
316316 self ._client .do_api_request (
317317 f'/v3/tags/{ quote_plus (tag_id )} /{ "," .join ([quote_plus (d ) for d in to_delete ])} ' , method = 'DELETE' )
318318
0 commit comments