Merge pull request #10037 from explosion/master

Update develop with master
This commit is contained in:
Sofie Van Landeghem 2022-01-12 12:29:23 +01:00 committed by GitHub
commit d8a3012539
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 6 deletions

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (C) 2016-2021 ExplosionAI GmbH, 2016 spaCy GmbH, 2015 Matthew Honnibal
Copyright (C) 2016-2022 ExplosionAI GmbH, 2016 spaCy GmbH, 2015 Matthew Honnibal
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,7 @@
from typing import Any, Dict, Optional
from pathlib import Path
from wasabi import msg
import os
import re
import shutil
import requests
@ -129,10 +130,17 @@ def fetch_asset(
the asset failed.
"""
dest_path = (project_path / dest).resolve()
if dest_path.exists() and checksum:
if dest_path.exists():
# If there's already a file, check for checksum
if checksum == get_checksum(dest_path):
msg.good(f"Skipping download with matching checksum: {dest}")
if checksum:
if checksum == get_checksum(dest_path):
msg.good(f"Skipping download with matching checksum: {dest}")
return
else:
# If there's not a checksum, make sure the file is a possibly valid size
if os.path.getsize(dest_path) == 0:
msg.warn(f"Asset exists but with size of 0 bytes, deleting: {dest}")
os.remove(dest_path)
# We might as well support the user here and create parent directories in
# case the asset dir isn't listed as a dir to create in the project.yml
if not dest_path.parent.exists():

View File

@ -22,7 +22,8 @@
"list": "89ad33e698"
},
"docSearch": {
"apiKey": "371e26ed49d29a27bd36273dfdaf89af",
"appId": "Y1LB128RON",
"apiKey": "bb601a1daab73e2dc66faf2b79564807",
"indexName": "spacy"
},
"binderUrl": "explosion/spacy-io-binder",

View File

@ -6,13 +6,14 @@ import Icon from './icon'
import classes from '../styles/search.module.sass'
export default function Search({ id = 'docsearch', placeholder = 'Search docs', settings = {} }) {
const { apiKey, indexName } = settings
const { apiKey, indexName, appId } = settings
if (!apiKey && !indexName) return null
const [initialized, setInitialized] = useState(false)
useEffect(() => {
if (!initialized) {
setInitialized(true)
window.docsearch({
appId,
apiKey,
indexName,
inputSelector: `#${id}`,

View File

@ -41,6 +41,7 @@ export const pageQuery = graphql`
docSearch {
apiKey
indexName
appId
}
}
}

View File

@ -235,6 +235,7 @@ export const pageQuery = graphql`
docSearch {
apiKey
indexName
appId
}
}
}