mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-09 12:58:31 +02:00
Snipets tooling update
- update README - generate-md.py: ignore trailing newlines when complaining about diffs - all langs: add more dependencies to templates - all langs: support @hide-start and @hide-end for multi-line hiding - go: also allow one-line imports - java: allow declarations other than `main` method - python, typescript: implement `unshorten` for implicit imports and client initialization - python: add mypy config as `datasets` lacks type py.typed - python: hide `# mypy:` annotations - typescript: add tsconfig that allows top-level `await`s - typescript: depend on @types/node to fix `import ... from "crypto"`
This commit is contained in:
@@ -65,6 +65,7 @@ class LanguageJava(Language):
|
||||
package\s[a-zA-Z0-9_.]+;\n
|
||||
(?P<imports> .*? )
|
||||
\s*public\ class\ Snippet\ \{\n
|
||||
(?P<methods> .*? )
|
||||
\s*public\ static\ void\ run\(\)\ throws\ Exception\ \{\n
|
||||
(?P<body> .*? )
|
||||
\s*\}\s*}\s*
|
||||
@@ -80,6 +81,10 @@ class LanguageJava(Language):
|
||||
import io.qdrant.client.QdrantClient;
|
||||
|
||||
public class Snippet {
|
||||
static void additionalMethod() {
|
||||
// Some additional method (optional)
|
||||
}
|
||||
|
||||
public static void run() throws Exception {
|
||||
// Your code here
|
||||
}
|
||||
@@ -94,7 +99,11 @@ class LanguageJava(Language):
|
||||
msg = "Invalid snippet format"
|
||||
raise ValueError(msg)
|
||||
return generic_shorten(
|
||||
m["imports"].strip() + "\n\n" + textwrap.dedent(m["body"]).strip()
|
||||
m["imports"].strip()
|
||||
+ "\n\n"
|
||||
+ textwrap.dedent(m["methods"]).strip()
|
||||
+ "\n\n"
|
||||
+ textwrap.dedent(m["body"]).strip()
|
||||
)
|
||||
|
||||
RE_RENDERED = re.compile(
|
||||
|
||||
Reference in New Issue
Block a user