Did I find the right examples for you? yes no

All Samples(8)  |  Call(6)  |  Derive(0)  |  Import(2)

        def optfail(msg):
    sys.stderr.write(msg)
    sys.stderr.write("\n")
    sys.exit(2)
        


src/z/s/zs-0.9.0/zs/cmdline/main.py   zs(Download)
import zs
 
from .util import optfail
 
# Docopt's exit conditions:
    subcommand = opts["<subcommand>"]
    if subcommand not in subcommands:
        optfail("Unrecognized subcommand %r; try --help for info"
                % (subcommand,))
    subcommand_fn = subcommands[subcommand]
                subopts[transopt(opt)] = int(subopts[opt])
            except ValueError:
                optfail("%s wants an integer, but got %r"
                        % (opt, subopts[opt]))
 
                subopts["__j__"] = int(subopts["-j"])
            except ValueError:
                optfail("-j should be an integer but got %r"
                        % (subopts["-j"],))
 
    if subopts.get("--length-prefixed") is not None:
        legal = ["u64le", "uleb128"]
        if subopts["--length-prefixed"] not in legal:
            optfail("Invalid --length-prefixed value %r: must be "

src/z/s/zs-0.9.0/zs/cmdline/make.py   zs(Download)
 
from zs import ZSWriter
from .util import optfail
 
def command_make(opts):
        metadata = json.loads(opts["<metadata>"])
    except ValueError as e:
        optfail("error parsing metadata as JSON: %s" % (e,))
 
    codec_kwargs = {}
            codec_kwargs["compress_level"] = int(cl)
        except ValueError:
            optfail("--compress-level must be an integer, or "
                    "(for lzma only) an integer followed by the letter e")