oc_chat
Loading...
Searching...
No Matches
gen_corpus.py File Reference

Go to the source code of this file.

Namespaces

namespace  gen_corpus

Functions

str gen_corpus._draw_tier1_program (random.Random rng)
str gen_corpus._draw_pip_subcommand (random.Random rng)
str gen_corpus._draw_tier2_program (random.Random rng)
str gen_corpus._draw_denied_program (random.Random rng)
str gen_corpus._draw_metacharacter_outside (random.Random rng)
str gen_corpus._draw_casing_suffix (random.Random rng)
str gen_corpus._draw_degenerate (random.Random rng)
str gen_corpus._quote (random.Random rng, str argument)
str gen_corpus._draw_backslash_path (random.Random rng)
str gen_corpus._draw_tilde_path (random.Random rng)
str gen_corpus._draw_hash_argument (random.Random rng)
str gen_corpus._splice_blank (random.Random rng, str host, str blank, bool quotable)
str gen_corpus._draw_invisible_space (random.Random rng)
str gen_corpus._draw_inline_blank (random.Random rng)
list[str] gen_corpus._cased (random.Random rng, list[str] words)
str gen_corpus._draw_prose_argument (random.Random rng)
tuple[str, str, str] gen_corpus._draw_quoted_payload (random.Random rng)
str gen_corpus._draw_non_ascii_path (random.Random rng)
str gen_corpus._draw_prose_pip (random.Random rng)
list[str] gen_corpus._draw_cluster_token (random.Random rng)
str gen_corpus._draw_option_cluster (random.Random rng)
str gen_corpus._draw_path_count (random.Random rng)
str gen_corpus._draw_option_shape (random.Random rng)
str gen_corpus._draw_head_shape (random.Random rng)
str gen_corpus._spell_head (str head, str spelling)
tuple[str,...] gen_corpus._draw_head_contrast (random.Random rng)
tuple[str,...] gen_corpus._draw (str family, random.Random rng)
Path gen_corpus.subproject_root ()
list[dict[str, str]] gen_corpus.read_jsonl (Path path)
list[dict[str, str]] gen_corpus.read_corpus (Path directory)
frozenset[str] gen_corpus.load_held_out (Path directory)
dict[str, dict[str, list[dict[str, str]]]] gen_corpus._pool (tuple[str,...] families, int target, random.Random rng, Path sandbox_root, frozenset[str] excluded)
list[dict[str, str]] gen_corpus._select (tuple[str,...] families, dict[str, dict[str, list[dict[str, str]]]] buckets, int target)
tuple[list[dict[str, str]], frozenset[str]] gen_corpus._group (tuple[str,...] families, int target, random.Random rng, Path sandbox_root, frozenset[str] excluded)
tuple[int, int, int, int] gen_corpus._group_targets (int total)
int gen_corpus.validation_rows (int total)
list[dict[str, str]] gen_corpus._validation_first (tuple[list[dict[str, str]],...] blocks)
list[dict[str, str]] gen_corpus.generate (int total, int seed, Path sandbox_root, frozenset[str] held_out)
tuple[int, int] gen_corpus.write_corpus (list[dict[str, str]] rows, Path directory, int|None held=None)
argparse.ArgumentParser gen_corpus._build_parser ()
int gen_corpus.main (list[str]|None argv=None)

Variables

int gen_corpus.DEFAULT_SEED = 7
int gen_corpus.DEFAULT_TOTAL = 37_500
float gen_corpus.WORD_FAMILY_SHARE = 0.2
float gen_corpus.STRUCTURE_FAMILY_SHARE = 0.15
float gen_corpus.HEAD_CONTRAST_SHARE = 0.10
int gen_corpus.STRUCTURE_SEED_OFFSET = 2
tuple gen_corpus.LABELS = ("allow", "confirm", "deny")
tuple gen_corpus.SHELL_FAMILIES
tuple gen_corpus.WORD_FAMILIES
tuple gen_corpus.STRUCTURE_FAMILIES_297
tuple gen_corpus.STRUCTURE_FAMILIES_299
tuple gen_corpus.STRUCTURE_FAMILIES = STRUCTURE_FAMILIES_297 + STRUCTURE_FAMILIES_299
tuple gen_corpus.FAMILIES = SHELL_FAMILIES + WORD_FAMILIES + STRUCTURE_FAMILIES
tuple gen_corpus._LISTING_OPTIONS_KNOWN
tuple gen_corpus._LISTING_OPTIONS_UNKNOWN
tuple gen_corpus._PATHS_INSIDE
tuple gen_corpus._PATHS_OUTSIDE
tuple gen_corpus._LOOKUP_TARGETS
tuple gen_corpus._ECHO_WORDS
tuple gen_corpus._PIP_SUBCOMMANDS
tuple gen_corpus._PIP_PACKAGES
tuple gen_corpus._PIP_OPTIONS_KNOWN = ("--format=json", "--format json", "--no-color")
tuple gen_corpus._PIP_OPTIONS_UNKNOWN
tuple gen_corpus._PIP_OPTIONS_INDEX
tuple gen_corpus._TIER2_PROGRAMS = ("python", "python3", "py", "pytest", "oct")
tuple gen_corpus._TIER2_ARGUMENTS
tuple gen_corpus._DENIED_PROGRAMS
tuple gen_corpus._DENIED_ARGUMENTS
tuple gen_corpus._METACHARACTER_SUFFIXES
tuple gen_corpus._DEGENERATE_HEADS
tuple gen_corpus._BARE_PROGRAMS
tuple gen_corpus._ARGUMENT_HEADS
tuple gen_corpus._BACKSLASH_PATHS
tuple gen_corpus._BACKSLASH_TRAILING
tuple gen_corpus._TILDE_PATHS
tuple gen_corpus._HASH_ARGUMENTS
tuple gen_corpus._HASH_HEADS
tuple gen_corpus._BLANK_HOSTS
tuple gen_corpus._INVISIBLE_BLANKS = ("\xa0", "\u200b")
tuple gen_corpus._INLINE_BLANKS = ("\t", "\x0b")
tuple gen_corpus._PROSE_WORDS
tuple gen_corpus._PROSE_HEADS
tuple gen_corpus._PROSE_TAILS_METACHAR
tuple gen_corpus._QUOTED_PAYLOADS
tuple gen_corpus._QUOTED_PAYLOAD_HEADS
tuple gen_corpus._QUOTED_PAYLOAD_DENY_HEADS = ("echo", "dir", "ls")
tuple gen_corpus._NON_ASCII_COMPONENTS
tuple gen_corpus._NON_ASCII_PREFIXES
tuple gen_corpus._NON_ASCII_LISTING_HEADS
tuple gen_corpus._NON_ASCII_NAME_HEADS = ("where", "which", "pip show")
tuple gen_corpus._PROSE_PIP_SUBCOMMANDS = ("install", "download", "list", "show")
tuple gen_corpus._PROSE_PIP_OPTIONS
tuple gen_corpus._PROSE_QUOTED_LEADS
tuple gen_corpus._CLUSTER_KNOWN_LETTERS = ("l", "a")
tuple gen_corpus._CLUSTER_UNKNOWN_LETTERS
tuple gen_corpus._COLOR_VALUES
tuple gen_corpus._LISTING_LONG_OPTIONS
tuple gen_corpus._BROKEN_CLUSTERS
tuple gen_corpus._DASH_TOKENS = ("-", "--", "---", "----")
tuple gen_corpus._STRUCTURE_PATHS_INSIDE
tuple gen_corpus._STRUCTURE_PATH_TOKENS
tuple gen_corpus._STRUCTURE_ALLOWED_OPTIONS
tuple gen_corpus._PIP_READONLY_ALLOWED
tuple gen_corpus._PIP_READONLY_NEAR_MISS
tuple gen_corpus._STRUCTURE_PACKAGES
tuple gen_corpus._PIP_INDEX_SHAPES
tuple gen_corpus._PIP_NON_INDEX_SHAPES
tuple gen_corpus._HEAD_CONTRAST_HEADS
tuple gen_corpus._HEAD_CONTRAST_HEADS_DISTINCT = tuple(dict.fromkeys(_HEAD_CONTRAST_HEADS))
tuple gen_corpus._HEAD_CONTRAST_SPELLINGS
tuple gen_corpus._HEAD_CONTRAST_SEPARATORS
tuple gen_corpus._HEAD_CONTRAST_PADDINGS
float gen_corpus._HEAD_CONTRAST_BARE_RATE = 0.22
dict gen_corpus._DRAWS