diff --git a/spacy/cli/_util.py b/spacy/cli/_util.py index caebf437c..f1ab2effc 100644 --- a/spacy/cli/_util.py +++ b/spacy/cli/_util.py @@ -262,6 +262,7 @@ def upload_file(src: Path, dest: Union[str, "Pathy"]) -> None: url (str): The destination URL to upload to. """ import smart_open + # This logic is pretty hacky. We'd like pathy to do this probably? if ":/" not in str(dest): # Local path @@ -288,6 +289,7 @@ def download_file(src: Union[str, "Pathy"], dest: Path, *, force: bool = False) If False, the download will be skipped. """ import smart_open + # This logic is pretty hacky. We'd like pathy to do this probably? if dest.exists() and not force: return None @@ -314,15 +316,19 @@ def ensure_pathy(path): return Pathy(path) -def git_sparse_checkout(repo: str, subpath: str, dest: Path, *, branch: Optional[str]=None): +def git_sparse_checkout( + repo: str, subpath: str, dest: Path, *, branch: Optional[str] = None +): if dest.exists(): raise IOError("Destination of checkout must not exist") if not dest.parent.exists(): raise IOError("Parent of destination of checkout must exist") # We're using Git and sparse checkout to only clone the files we need with make_tempdir() as tmp_dir: - cmd = (f"git clone {repo} {tmp_dir} --no-checkout " - "--depth 1 --config core.sparseCheckout=true") + cmd = ( + f"git clone {repo} {tmp_dir} --no-checkout " + "--depth 1 --config core.sparseCheckout=true" + ) if branch is not None: cmd = f"{cmd} -b {branch}" run_command(cmd) @@ -334,5 +340,3 @@ def git_sparse_checkout(repo: str, subpath: str, dest: Path, *, branch: Optional shutil.move(str(tmp_dir / Path(subpath)), str(dest)) print(dest) print(list(dest.iterdir())) - - diff --git a/spacy/cli/convert.py b/spacy/cli/convert.py index 91ec75339..f73c2f2c0 100644 --- a/spacy/cli/convert.py +++ b/spacy/cli/convert.py @@ -102,7 +102,7 @@ def convert( converter: str = "auto", ner_map: Optional[Path] = None, lang: Optional[str] = None, - concatenate: bool=False, + concatenate: bool = False, silent: bool = True, msg: Optional[Printer], ) -> None: diff --git a/spacy/scorer.py b/spacy/scorer.py index 5a5e38f15..d9cdb70c4 100644 --- a/spacy/scorer.py +++ b/spacy/scorer.py @@ -40,7 +40,7 @@ class PRFScore: def fscore(self) -> float: p = self.precision r = self.recall - return (2 * ((p * r) / (p + r + 1e-100))) + return 2 * ((p * r) / (p + r + 1e-100)) def to_dict(self) -> Dict[str, float]: return {"p": self.precision, "r": self.recall, "f": self.fscore}