-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jack Cherng <[email protected]>
- Loading branch information
Showing
15 changed files
with
325 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// This is a comment, and is ignored by the compiler. | ||
// You can test this code by clicking the "Run" button over there -> | ||
// or if you prefer to use your keyboard, you can use the "Ctrl + Enter" | ||
// shortcut. | ||
|
||
// This code is editable, feel free to hack it! | ||
// You can always return to the original code by clicking the "Reset" button -> | ||
|
||
// This is the main function. | ||
fn main() { | ||
// Statements here are executed when the compiled binary is called. | ||
|
||
// Print text to the console. | ||
println!("Hello World!"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from magika import magika as magika, prediction_mode as prediction_mode | ||
|
||
Magika = magika.Magika | ||
MagikaError = magika.MagikaError | ||
PredictionMode = prediction_mode.PredictionMode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from _typeshed import Incomplete | ||
from magika import Magika as Magika, MagikaError as MagikaError, PredictionMode as PredictionMode, colors as colors | ||
from magika.content_types import ContentTypesManager as ContentTypesManager | ||
from magika.logger import get_logger as get_logger | ||
from magika.types import FeedbackReport as FeedbackReport, MagikaResult as MagikaResult | ||
from pathlib import Path | ||
from typing import List, Optional | ||
|
||
VERSION: str | ||
CONTACT_EMAIL: str | ||
CONTEXT_SETTINGS: Incomplete | ||
HELP_EPILOG: Incomplete | ||
|
||
def main(file: List[Path], recursive: bool, json_output: bool, jsonl_output: bool, mime_output: bool, label_output: bool, magic_compatibility_mode: bool, output_score: bool, prediction_mode_str: str, batch_size: int, no_dereference: bool, with_colors: bool, verbose: bool, debug: bool, generate_report_flag: bool, output_version: bool, list_output_content_types: bool, model_dir: Optional[Path]) -> None: ... | ||
def should_read_from_stdin(files_paths: List[Path]) -> bool: ... | ||
def get_magika_result_from_stdin(magika: Magika) -> MagikaResult: ... | ||
def generate_feedback_report(magika: Magika, file_path: Path, magika_result: MagikaResult) -> FeedbackReport: ... | ||
def print_feedback_report(magika: Magika, reports: List[FeedbackReport]) -> None: ... | ||
def print_output_content_types_list() -> None: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
BLACK: str | ||
RED: str | ||
GREEN: str | ||
YELLOW: str | ||
BLUE: str | ||
PURPLE: str | ||
CYAN: str | ||
LIGHT_GRAY: str | ||
DARK_GRAY: str | ||
LIGHT_RED: str | ||
LIGHT_GREEN: str | ||
LIGHT_YELLOW: str | ||
LIGHT_BLUE: str | ||
LIGHT_PURPLE: str | ||
LIGHT_CYAN: str | ||
WHITE: str | ||
RESET: str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
from _typeshed import Incomplete | ||
from pathlib import Path | ||
from typing import Any, Dict, Iterable, List, Optional | ||
|
||
CONTENT_TYPES_CONFIG_PATH: Incomplete | ||
|
||
class ContentType: | ||
UNKNOWN: str | ||
UNKNOWN_MIME_TYPE: str | ||
UNKNOWN_CONTENT_TYPE_GROUP: str | ||
UNKNOWN_MAGIC: str | ||
UNKNOWN_DESCRIPTION: str | ||
UNSUPPORTED: str | ||
ERROR: str | ||
MISSING: str | ||
EMPTY: str | ||
CORRUPTED: str | ||
TIMEOUT: str | ||
NOT_VALID: str | ||
FILE_DOES_NOT_EXIST: str | ||
PERMISSION_ERROR: str | ||
DIRECTORY: str | ||
SYMLINK: str | ||
GENERIC_TEXT: str | ||
name: Incomplete | ||
extensions: Incomplete | ||
mime_type: Incomplete | ||
group: Incomplete | ||
magic: Incomplete | ||
description: Incomplete | ||
vt_type: Incomplete | ||
datasets: Incomplete | ||
parent: Incomplete | ||
tags: Incomplete | ||
model_target_label: Incomplete | ||
target_label: Incomplete | ||
correct_labels: Incomplete | ||
in_scope_for_output_content_type: Incomplete | ||
def __init__(self, name: str, extensions: List[str], mime_type: Optional[str], group: Optional[str], magic: Optional[str], description: Optional[str], vt_type: Optional[str], datasets: List[str], parent: Optional[str], tags: List[str], model_target_label: Optional[str], target_label: Optional[str], correct_labels: List[str], in_scope_for_output_content_type: bool, add_automatic_tags: bool = True) -> None: ... | ||
@property | ||
def is_text(self) -> bool: ... | ||
@property | ||
def in_scope_for_training(self) -> bool: ... | ||
def to_dict(self) -> Dict[str, Any]: ... | ||
@staticmethod | ||
def from_dict(info_d: Dict, add_automatic_tags: bool = True) -> ContentType: ... | ||
|
||
class ContentTypesManager: | ||
SPECIAL_CONTENT_TYPES: List[str] | ||
SUPPORTED_TARGET_LABELS_SPEC: Incomplete | ||
cts: Incomplete | ||
tag2cts: Incomplete | ||
ext2cts: Incomplete | ||
def __init__(self, content_type_config_path: Path = ..., add_automatic_tags: bool = True) -> None: ... | ||
def load_content_types_info(self, content_type_config_path: Path, add_automatic_tags: bool = True) -> None: ... | ||
def get(self, content_type_name: str) -> Optional[ContentType]: ... | ||
def get_or_raise(self, content_type_name: Optional[str]) -> ContentType: ... | ||
def get_mime_type(self, content_type_name: str, default: str = ...) -> str: ... | ||
def get_group(self, content_type_name: str, default: str = ...) -> str: ... | ||
def get_magic(self, content_type_name: str, default: str = ..., fallback_to_label: bool = True) -> str: ... | ||
def get_description(self, content_type_name: str, default: str = ..., fallback_to_label: bool = True) -> str: ... | ||
def get_cts_by_ext(self, ext: str) -> List[ContentType]: ... | ||
def get_cts_by_ext_or_raise(self, ext: str) -> List[ContentType]: ... | ||
def get_valid_tags(self, only_explicit: bool = True) -> List[str]: ... | ||
def is_valid_ct_label(self, label: str) -> bool: ... | ||
def is_valid_tag(self, tag: str) -> bool: ... | ||
def select(self, query: Optional[str] = None, must_be_in_scope_for_training: bool = True) -> List[ContentType]: ... | ||
def select_names(self, query: Optional[str] = None, must_be_in_scope_for_training: bool = True) -> List[str]: ... | ||
def get_content_types_space(self) -> List[str]: ... | ||
def get_output_content_types(self) -> List[ContentType]: ... | ||
def get_output_content_types_names(self) -> List[str]: ... | ||
def get_invalid_labels(self, labels: Iterable[str]) -> List[str]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from _typeshed import Incomplete | ||
from magika import colors as colors | ||
from typing import TextIO | ||
|
||
class SimpleLogger: | ||
level: Incomplete | ||
use_colors: Incomplete | ||
def __init__(self, use_colors: bool = False) -> None: ... | ||
def setLevel(self, level: int) -> None: ... | ||
def raw_print_to_stdout(self, msg: str) -> None: ... | ||
def raw_print(self, msg: str, file: TextIO = ...) -> None: ... | ||
def debug(self, msg: str) -> None: ... | ||
def info(self, msg: str) -> None: ... | ||
def warning(self, msg: str) -> None: ... | ||
def error(self, msg: str) -> None: ... | ||
|
||
def get_logger(use_colors: bool = False) -> SimpleLogger: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from magika.content_types import ContentType as ContentType, ContentTypesManager as ContentTypesManager | ||
from magika.logger import get_logger as get_logger | ||
from magika.prediction_mode import PredictionMode as PredictionMode | ||
from magika.types import MagikaOutputFields as MagikaOutputFields, MagikaResult as MagikaResult, ModelFeatures as ModelFeatures, ModelOutput as ModelOutput, ModelOutputFields as ModelOutputFields | ||
from pathlib import Path | ||
from typing import List, Optional | ||
|
||
class Magika: | ||
def __init__(self, model_dir: Optional[Path] = None, prediction_mode: PredictionMode = ..., no_dereference: bool = False, verbose: bool = False, debug: bool = False, use_colors: bool = False) -> None: ... | ||
def identify_path(self, path: Path) -> MagikaResult: ... | ||
def identify_paths(self, paths: List[Path]) -> List[MagikaResult]: ... | ||
def identify_bytes(self, content: bytes) -> MagikaResult: ... | ||
@staticmethod | ||
def get_default_model_name() -> str: ... | ||
def get_model_name(self) -> str: ... | ||
|
||
class MagikaError(Exception): ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from _typeshed import Incomplete | ||
from magika.strenum import LowerCaseStrEnum as LowerCaseStrEnum | ||
from typing import List | ||
|
||
class PredictionMode(LowerCaseStrEnum): | ||
BEST_GUESS: Incomplete | ||
MEDIUM_CONFIDENCE: Incomplete | ||
HIGH_CONFIDENCE: Incomplete | ||
@staticmethod | ||
def get_valid_prediction_modes() -> List[str]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import enum | ||
|
||
class StrEnum(str, enum.Enum): | ||
def __new__(cls, value: str | StrEnum, *args, **kwargs): ... | ||
|
||
class LowerCaseStrEnum(StrEnum): ... |
Oops, something went wrong.