tools/site_compare/commands/maskmaker.py
def CreateCommand(cmdline):
  """Inserts the command and arguments into a command line for parsing."""
  cmd = cmdline.AddCommand(
    ["maskmaker"],
    "Automatically generates a mask from a list of URLs",
    ValidateMaskmaker,
    ExecuteMaskmaker)

  cmd.AddArgument(
    ["-bp", "--browserpath"], "Full path to browser's executable",
    type="readfile", metaname="PATH")
  cmd.AddArgument(
    ["-b", "--browser"], "Which browser to use", type="string",
    default="chrome")
  cmd.AddArgument(
    ["-bv", "--browserver"], "Version of the browser", metaname="VERSION")
  cmd.AddArgument(
    ["-o", "--outdir"], "Directory to store generated masks", metaname="DIR",
    required=True)
  cmd.AddArgument(
    ["-u", "--url"], "URL to compare")
  cmd.AddArgument(
    ["-l", "--list"], "List of URLs to compare", type="readfile")
  cmd.AddMutualExclusion(["--url", "--list"])
  cmd.AddArgument(
    ["-s", "--startline"], "First line of URL list", type="int")
  cmd.AddArgument(
    ["-e", "--endline"], "Last line of URL list (exclusive)", type="int")
  cmd.AddArgument(
    ["-c", "--count"], "Number of lines of URL file to use", type="int")
  cmd.AddDependency("--startline", "--list")
  cmd.AddRequiredGroup(["--url", "--list"])
  cmd.AddDependency("--endline", "--list")
  cmd.AddDependency("--count", "--list")
  cmd.AddMutualExclusion(["--count", "--endline"])
  cmd.AddDependency("--count", "--startline")
  cmd.AddArgument(
    ["-t", "--timeout"], "Amount of time (seconds) to wait for browser to "
    "finish loading",
    type="int", default=60)
  cmd.AddArgument(
    ["-w", "--wait"],
    "Amount of time (in seconds) to wait between successive scrapes",
    type="int", default=60)
  cmd.AddArgument(
    ["-sc", "--scrapes"],
    "Number of successive scrapes which must result in no change to a mask "
    "before mask creation is considered complete", type="int", default=10)
  cmd.AddArgument(
    ["-sz", "--size"], "Browser window size", default=(800, 600), type="coords")
  cmd.AddArgument(["-sd", "--scrapedir"], "Directory to store scrapes")
  cmd.AddArgument(
    ["-gu", "--giveup"],
    "Number of times to scrape before giving up", type="int", default=50)
  cmd.AddArgument(
    ["-th", "--threshhold"],
    "Percentage of different pixels (0-100) above which the scrape will be"
    "discarded and the mask not updated.", type="int", default=100)
  cmd.AddArgument(
    ["--er", "--errors"],
    "Number of times a scrape can fail before giving up on the URL.",
    type="int", default=1)
Inserts the command and arguments into a command line for parsing.
Inserts the command and arguments into a command line for parsing.
Inserts the command and arguments into a command line for parsing .
def CreateCommand(cmdline):
  cmd = cmdline.AddCommand(
    ["maskmaker"],
    "Automatically generates a mask from a list of URLs",
    ValidateMaskmaker,
    ExecuteMaskmaker)
  cmd.AddArgument(
    ["-bp", "--browserpath"], "Full path to browser's executable",
    type="readfile", metaname="PATH")
  cmd.AddArgument(
    ["-b", "--browser"], "Which browser to use", type="string",
    default="chrome")
  cmd.AddArgument(
    ["-bv", "--browserver"], "Version of the browser", metaname="VERSION")
  cmd.AddArgument(
    ["-o", "--outdir"], "Directory to store generated masks", metaname="DIR",
    required=True)
  cmd.AddArgument(
    ["-u", "--url"], "URL to compare")
  cmd.AddArgument(
    ["-l", "--list"], "List of URLs to compare", type="readfile")
  cmd.AddMutualExclusion(["--url", "--list"])
  cmd.AddArgument(
    ["-s", "--startline"], "First line of URL list", type="int")
  cmd.AddArgument(
    ["-e", "--endline"], "Last line of URL list (exclusive)", type="int")
  cmd.AddArgument(
    ["-c", "--count"], "Number of lines of URL file to use", type="int")
  cmd.AddDependency("--startline", "--list")
  cmd.AddRequiredGroup(["--url", "--list"])
  cmd.AddDependency("--endline", "--list")
  cmd.AddDependency("--count", "--list")
  cmd.AddMutualExclusion(["--count", "--endline"])
  cmd.AddDependency("--count", "--startline")
  cmd.AddArgument(
    ["-t", "--timeout"], "Amount of time (seconds) to wait for browser to "
    "finish loading",
    type="int", default=60)
  cmd.AddArgument(
    ["-w", "--wait"],
    "Amount of time (in seconds) to wait between successive scrapes",
    type="int", default=60)
  cmd.AddArgument(
    ["-sc", "--scrapes"],
    "Number of successive scrapes which must result in no change to a mask "
    "before mask creation is considered complete", type="int", default=10)
  cmd.AddArgument(
    ["-sz", "--size"], "Browser window size", default=(800, 600), type="coords")
  cmd.AddArgument(["-sd", "--scrapedir"], "Directory to store scrapes")
  cmd.AddArgument(
    ["-gu", "--giveup"],
    "Number of times to scrape before giving up", type="int", default=50)
  cmd.AddArgument(
    ["-th", "--threshhold"],
    "Percentage of different pixels (0-100) above which the scrape will be"
    "discarded and the mask not updated.", type="int", default=100)
  cmd.AddArgument(
    ["--er", "--errors"],
    "Number of times a scrape can fail before giving up on the URL.",
    type="int", default=1)
def CreateCommand ( cmdline ) : cmd = cmdline . AddCommand ( [ "maskmaker" ] , "Automatically generates a mask from a list of URLs" , ValidateMaskmaker , ExecuteMaskmaker ) cmd . AddArgument ( [ "-bp" , "--browserpath" ] , "Full path to browser's executable" , type = "readfile" , metaname = "PATH" ) cmd . AddArgument ( [ "-b" , "--browser" ] , "Which browser to use" , type = "string" , default = "chrome" ) cmd . AddArgument ( [ "-bv" , "--browserver" ] , "Version of the browser" , metaname = "VERSION" ) cmd . AddArgument ( [ "-o" , "--outdir" ] , "Directory to store generated masks" , metaname = "DIR" , required = True ) cmd . AddArgument ( [ "-u" , "--url" ] , "URL to compare" ) cmd . AddArgument ( [ "-l" , "--list" ] , "List of URLs to compare" , type = "readfile" ) cmd . AddMutualExclusion ( [ "--url" , "--list" ] ) cmd . AddArgument ( [ "-s" , "--startline" ] , "First line of URL list" , type = "int" ) cmd . AddArgument ( [ "-e" , "--endline" ] , "Last line of URL list (exclusive)" , type = "int" ) cmd . AddArgument ( [ "-c" , "--count" ] , "Number of lines of URL file to use" , type = "int" ) cmd . AddDependency ( "--startline" , "--list" ) cmd . AddRequiredGroup ( [ "--url" , "--list" ] ) cmd . AddDependency ( "--endline" , "--list" ) cmd . AddDependency ( "--count" , "--list" ) cmd . AddMutualExclusion ( [ "--count" , "--endline" ] ) cmd . AddDependency ( "--count" , "--startline" ) cmd . AddArgument ( [ "-t" , "--timeout" ] , "Amount of time (seconds) to wait for browser to " "finish loading" , type = "int" , default = 60 ) cmd . AddArgument ( [ "-w" , "--wait" ] , "Amount of time (in seconds) to wait between successive scrapes" , type = "int" , default = 60 ) cmd . AddArgument ( [ "-sc" , "--scrapes" ] , "Number of successive scrapes which must result in no change to a mask " "before mask creation is considered complete" , type = "int" , default = 10 ) cmd . AddArgument ( [ "-sz" , "--size" ] , "Browser window size" , default = ( 800 , 600 ) , type = "coords" ) cmd . AddArgument ( [ "-sd" , "--scrapedir" ] , "Directory to store scrapes" ) cmd . AddArgument ( [ "-gu" , "--giveup" ] , "Number of times to scrape before giving up" , type = "int" , default = 50 ) cmd . AddArgument ( [ "-th" , "--threshhold" ] , "Percentage of different pixels (0-100) above which the scrape will be" "discarded and the mask not updated." , type = "int" , default = 100 ) cmd . AddArgument ( [ "--er" , "--errors" ] , "Number of times a scrape can fail before giving up on the URL." , type = "int" , default = 1 )
Inserts the command and arguments into a command line for parsing.
Inserts the command and arguments into a command line for parsing .
"""Inserts the command and arguments into a command line for parsing."""
cmdline