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) 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 Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,7 @@
from typing import Any, Dict, Optional from typing import Any, Dict, Optional
from pathlib import Path from pathlib import Path
from wasabi import msg from wasabi import msg
import os
import re import re
import shutil import shutil
import requests import requests
@ -129,10 +130,17 @@ def fetch_asset(
the asset failed. the asset failed.
""" """
dest_path = (project_path / dest).resolve() 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 there's already a file, check for checksum
if checksum == get_checksum(dest_path): if checksum:
msg.good(f"Skipping download with matching checksum: {dest}") 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 # 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 # case the asset dir isn't listed as a dir to create in the project.yml
if not dest_path.parent.exists(): if not dest_path.parent.exists():

View File

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

View File

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

View File

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

View File

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