@@ -256,13 +256,7 @@ def generate_version(self, settings):
256256
257257 def train (
258258 self ,
259- new_version_settings = {
260- "preprocessing" : {
261- "auto-orient" : True ,
262- "resize" : {"width" : 640 , "height" : 640 , "format" : "Stretch to" },
263- },
264- "augmentation" : {},
265- },
259+ new_version_settings : Optional [Dict ] = None ,
266260 speed = None ,
267261 checkpoint = None ,
268262 plot_in_notebook = False ,
@@ -294,6 +288,15 @@ def train(
294288 >>> version.train()
295289 """ # noqa: E501 // docs
296290
291+ if new_version_settings is None :
292+ new_version_settings = {
293+ "preprocessing" : {
294+ "auto-orient" : True ,
295+ "resize" : {"width" : 640 , "height" : 640 , "format" : "Stretch to" },
296+ },
297+ "augmentation" : {},
298+ }
299+
297300 new_version = self .generate_version (settings = new_version_settings )
298301 new_version = self .version (new_version )
299302 new_model = new_version .train (speed = speed , checkpoint = checkpoint , plot_in_notebook = plot_in_notebook )
@@ -384,7 +387,7 @@ def upload(
384387 split : str = "train" ,
385388 num_retry_uploads : int = 0 ,
386389 batch_name : Optional [str ] = None ,
387- tag_names : list = [] ,
390+ tag_names : Optional [ List [ str ]] = None ,
388391 is_prediction : bool = False ,
389392 ** kwargs ,
390393 ):
@@ -413,6 +416,9 @@ def upload(
413416 >>> project.upload(image_path="YOUR_IMAGE.jpg")
414417 """ # noqa: E501 // docs
415418
419+ if tag_names is None :
420+ tag_names = []
421+
416422 is_hosted = image_path .startswith ("http://" ) or image_path .startswith ("https://" )
417423
418424 is_file = os .path .isfile (image_path ) or is_hosted
@@ -476,13 +482,16 @@ def upload_image(
476482 split = "train" ,
477483 num_retry_uploads = 0 ,
478484 batch_name = None ,
479- tag_names = [] ,
485+ tag_names : Optional [ List [ str ]] = None ,
480486 sequence_number = None ,
481487 sequence_size = None ,
482488 ** kwargs ,
483489 ):
484490 project_url = self .id .rsplit ("/" )[1 ]
485491
492+ if tag_names is None :
493+ tag_names = []
494+
486495 t0 = time .time ()
487496 upload_retry_attempts = 0
488497 retry = Retry (num_retry_uploads , ImageUploadError )
@@ -557,13 +566,15 @@ def single_upload(
557566 split = "train" ,
558567 num_retry_uploads = 0 ,
559568 batch_name = None ,
560- tag_names = [] ,
569+ tag_names : Optional [ List [ str ]] = None ,
561570 is_prediction : bool = False ,
562571 annotation_overwrite = False ,
563572 sequence_number = None ,
564573 sequence_size = None ,
565574 ** kwargs ,
566575 ):
576+ if tag_names is None :
577+ tag_names = []
567578 if image_path and image_id :
568579 raise Exception ("You can't pass both image_id and image_path" )
569580 if not (image_path or image_id ):
@@ -641,7 +652,7 @@ def search(
641652 in_dataset : Optional [str ] = None ,
642653 batch : bool = False ,
643654 batch_id : Optional [str ] = None ,
644- fields : list = [ "id" , "created" , "name" , "labels" ] ,
655+ fields : Optional [ List [ str ]] = None ,
645656 ):
646657 """
647658 Search for images in a project.
@@ -670,6 +681,9 @@ def search(
670681
671682 >>> results = project.search(query="cat", limit=10)
672683 """ # noqa: E501 // docs
684+ if fields is None :
685+ fields = ["id" , "created" , "name" , "labels" ]
686+
673687 payload : Dict [str , Union [str , int , List [str ]]] = {}
674688
675689 if like_image is not None :
@@ -719,7 +733,7 @@ def search_all(
719733 in_dataset : Optional [str ] = None ,
720734 batch : bool = False ,
721735 batch_id : Optional [str ] = None ,
722- fields : list = [ "id" , "created" ] ,
736+ fields : Optional [ List [ str ]] = None ,
723737 ):
724738 """
725739 Create a paginated list of search results for use in searching the images in a project.
@@ -752,6 +766,9 @@ def search_all(
752766
753767 >>> print(result)
754768 """ # noqa: E501 // docs
769+ if fields is None :
770+ fields = ["id" , "created" ]
771+
755772 while True :
756773 data = self .search (
757774 like_image = like_image ,
0 commit comments