mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 01:48:04 +03:00 
			
		
		
		
	Don't print in parse_package_meta and accept on_erro callback instead
TODO: log warning for missing meta data in spacy.link, as this affects the Language class returned by spacy.load()
This commit is contained in:
		
							parent
							
								
									d8c984b65e
								
							
						
					
					
						commit
						3d484c3faf
					
				| 
						 | 
					@ -149,11 +149,10 @@ def check_renamed_kwargs(renamed, kwargs):
 | 
				
			||||||
            raise TypeError("Keyword argument %s now renamed to %s" % (old, new))
 | 
					            raise TypeError("Keyword argument %s now renamed to %s" % (old, new))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def parse_package_meta(package_path, package):
 | 
					def parse_package_meta(package_path, package, on_error=False):
 | 
				
			||||||
    location = os.path.join(str(package_path), package, 'meta.json')
 | 
					    location = os.path.join(str(package_path), package, 'meta.json')
 | 
				
			||||||
    if not os.path.isfile(location):
 | 
					    if not os.path.isfile(location) and on_error:
 | 
				
			||||||
        print_msg("'{p}' doesn't seem to be a valid model package.".format(p=package),
 | 
					        on_error()
 | 
				
			||||||
             title="No meta.json found")
 | 
					 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        with io.open(location, encoding='utf8') as f:
 | 
					        with io.open(location, encoding='utf8') as f:
 | 
				
			||||||
            meta = json.load(f)
 | 
					            meta = json.load(f)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user