fix: reformatted to unify syntax
This commit is contained in:
parent
65b3f4a152
commit
9fe8507906
1 changed files with 5 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ from magika import Magika
|
||||||
|
|
||||||
magika = Magika()
|
magika = Magika()
|
||||||
|
|
||||||
|
|
||||||
class _CustomMarkdownify(markdownify.MarkdownConverter):
|
class _CustomMarkdownify(markdownify.MarkdownConverter):
|
||||||
"""
|
"""
|
||||||
A custom version of markdownify's MarkdownConverter. Changes include:
|
A custom version of markdownify's MarkdownConverter. Changes include:
|
||||||
|
|
@ -26,7 +27,10 @@ class _CustomMarkdownify(markdownify.MarkdownConverter):
|
||||||
if not extracted_code_snippet:
|
if not extracted_code_snippet:
|
||||||
return ""
|
return ""
|
||||||
result = magika.identify_bytes(extracted_code_snippet.encode())
|
result = magika.identify_bytes(extracted_code_snippet.encode())
|
||||||
if result.status == "ok" and result.prediction.output.group in ["text", "code"]:
|
if result.status == "ok" and result.prediction.output.group in [
|
||||||
|
"text",
|
||||||
|
"code",
|
||||||
|
]:
|
||||||
language = result.prediction.output.label
|
language = result.prediction.output.label
|
||||||
return language
|
return language
|
||||||
return ""
|
return ""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue