mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 09:57:26 +03:00 
			
		
		
		
	Return None for data path if it doesn't exist
This commit is contained in:
		
							parent
							
								
									e4862d1dab
								
							
						
					
					
						commit
						d9a77ddf14
					
				| 
						 | 
					@ -33,7 +33,7 @@ def get_lang_class(name):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def get_data_path():
 | 
					def get_data_path():
 | 
				
			||||||
    return _data_path
 | 
					    return _data_path if _data_path.exists() else None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def set_data_path(path):
 | 
					def set_data_path(path):
 | 
				
			||||||
| 
						 | 
					@ -54,7 +54,7 @@ def or_(val1, val2):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def match_best_version(target_name, target_version, path):
 | 
					def match_best_version(target_name, target_version, path):
 | 
				
			||||||
    path = path if not isinstance(path, basestring) else pathlib.Path(path)
 | 
					    path = path if not isinstance(path, basestring) else pathlib.Path(path)
 | 
				
			||||||
    if not path.exists():
 | 
					    if path is None or not path.exists():
 | 
				
			||||||
        return None
 | 
					        return None
 | 
				
			||||||
    matches = []
 | 
					    matches = []
 | 
				
			||||||
    for data_name in path.iterdir():
 | 
					    for data_name in path.iterdir():
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user