Sample usage for this python module

    This main method simply illustrates sample usage for this python
    module.

    :return: None
326035
def main():
    
    log = logging.getLogger(mod_logger + '.main')
    parser = argparse.ArgumentParser(description='cons3rt deployment CLI')
    parser.add_argument('command', help='Command for the deployment CLI')
    parser.add_argument('--network', help='Name of the network')
    parser.add_argument('--name', help='Name of a deployment property to get')
    args = parser.parse_args()

    valid_commands = ['ip', 'device', 'prop']
    valid_commands_str = ','.join(valid_commands)

    # Get the command
    command = args.command.strip().lower()

    # Ensure the command is valid
    if command not in valid_commands:
        print('Invalid command found [{c}]\n'.format(c=command) + valid_commands_str)
        return 1

    if command == 'ip':
        if not args.network:
            print('Missed arg: --network, for the name of the network')
    elif command == 'device':
        if not args.network:
            print('Missed arg: --network, for the name of the network')
            return 1
        d = Deployment()
        print(d.get_device_for_network_linux(network_name=args.network))
    elif command == 'prop':
        if not args.name:
            print('Missed arg: --name, for the name of the property to retrieve')
            return 1
        d = Deployment()
        print(d.get_value(property_name=args.name))
1298359
def main() -> None:
    """"""

    # Make sure we have access to self
    if 'self' not in globals():
        print("Run 'set locals_in_py true' and then rerun this script")
        return

    # Make sure the user passed in an output file
    if len(sys.argv) != 2:
        print("Usage: {} <output_file>".format(os.path.basename(sys.argv[0])))
        return

    # Open the output file
    outfile_path = os.path.expanduser(sys.argv[1])
    try:
        outfile = open(outfile_path, 'w')
    except OSError as e:
        print("Error opening {} because: {}".format(outfile_path, e))
        return

    # Write the help summary
    header = '{0}\nSUMMARY\n{0}\n'.format(ASTERISKS)
    outfile.write(header)

    result = app('help -v')
    outfile.write(result.stdout)

    # Get a list of all commands and help topics and then filter out duplicates
    all_commands = set(self.get_all_commands())
    all_topics = set(self.get_help_topics())
    to_save = list(all_commands | all_topics)
    to_save.sort()

    for item in to_save:
        is_command = item in all_commands
        add_help_to_file(item, outfile, is_command)

        if is_command:
            # Add any sub-commands
            for subcmd in get_sub_commands(getattr(self.cmd_func(item), 'argparser', None)):
                full_cmd = '{} {}'.format(item, subcmd)
                add_help_to_file(full_cmd, outfile, is_command)

    outfile.close()
    print("Output written to {}".format(outfile_path))
414729
def main():
    
    if "-h" in sys.argv:
        print(main.__doc__)
        sys.exit()

    dataframe = extractor.command_line_dataframe([['WD', False, '.'], ['ID', False, '.'], ['f', True, ''], ['Fsa', False, 'samples.txt'], ['DM', False, 3]])
    args = sys.argv
    checked_args = extractor.extract_and_check_args(args, dataframe)
    samp_file, output_samp_file, output_dir_path, input_dir_path, data_model_num = extractor.get_vars(['f', 'Fsa', 'WD', 'ID', 'DM'], checked_args)
    data_model_num = int(float(data_model_num))
    if '-Fsa' not in args and data_model_num == 2:
        output_samp_file = "er_samples.txt"
    ran, error = convert.iodp_samples(samp_file, output_samp_file, output_dir_path,
                                      input_dir_path, data_model_num=data_model_num)
    if not ran:
        print("-W- " + error)
1625
def _main():
    
    import sys

    def log(message):
        print(message)

    def print_usage():
        log('usage: %s <application key> <application secret> send <number> <message> <from_number>' % sys.argv[0])
        log('       %s <application key> <application secret> status <message_id>' % sys.argv[0])

    if len(sys.argv) > 4 and sys.argv[3] == 'send':
        key, secret, number, message = sys.argv[1], sys.argv[2], sys.argv[4], sys.argv[5]
        client = SinchSMS(key, secret)
        if len(sys.argv) > 6:
            log(client.send_message(number, message, sys.argv[6]))
        else:
            log(client.send_message(number, message))
    elif len(sys.argv) > 3 and sys.argv[3] == 'status':
        key, secret, message_id = sys.argv[1], sys.argv[2], sys.argv[4]
        client = SinchSMS(key, secret)
        log(client.check_status(message_id))
    else:
        print_usage()
        sys.exit(1)

    sys.exit(0)
1294765
def main():

    usage = "usage: %(prog)s [options] "
    description = "Run gtselect and gtmktime on one or more FT1 files.  "
    ""
    parser = argparse.ArgumentParser(usage=usage, description=description)

    add_lsf_args(parser)
    parser.add_argument('--zmax', default=100., type=float, help='')
    parser.add_argument('--dcostheta', default=0.025, type=float, help='')
    parser.add_argument('--binsz', default=1.0, type=float, help='')
    parser.add_argument('--outdir', default=None, type=str,
                        help='Path to output directory used when merge=False.')
    parser.add_argument('--outfile', default=None, type=str,
                        help='Path to output file used when merge=True.')
    parser.add_argument('--scfile', default=None, type=str, help='',
                        required=True)

    parser.add_argument('--dry_run', default=False, action='store_true')
    parser.add_argument('--overwrite', default=False, action='store_true')
    parser.add_argument('--merge', default=False, action='store_true',
                        help='Merge input FT1 files into a single file.')

    parser.add_argument('files', nargs='+', default=None,
                        help='List of directories in which the analysis will '
                             'be run.')

    args = parser.parse_args()

    args.outdir = os.path.abspath(args.outdir)
    args.scfile = os.path.abspath(args.scfile)
    mkdir(args.outdir)
    input_files = [[os.path.abspath(x)] for x in args.files]
    output_files = [os.path.join(args.outdir, os.path.basename(x))
                    for x in args.files]

    if args.batch:
        opts = copy.deepcopy(args.__dict__)
        opts.pop('files')
        opts.pop('batch')
        submit_jobs('python ' + os.path.abspath(__file__.rstrip('cd')),
                    input_files, output_files, {k: v for k, v in opts.items()})
        sys.exit(0)

    logger = Logger.get(os.path.basename(__file__), None, logging.INFO)
    logger.info('Starting.')
    cwd = os.getcwd()
    user = os.environ['USER']
    tmpdir = tempfile.mkdtemp(prefix=user + '.', dir='/scratch')
    os.chdir(tmpdir)

    logger.info('tmpdir %s', tmpdir)
    logger.info('outdir %s', args.outdir)
    logger.info('outfile %s', args.outfile)

    for infiles, outfile in zip(input_files, output_files):

        logger.info('infiles %s', pprint.pformat(infiles))
        logger.info('outfile %s', outfile)

        kw = dict(evfile='list.txt',
                  scfile=args.scfile,
                  outfile='ltcube.fits',
                  binsz=args.binsz,
                  dcostheta=args.dcostheta,
                  zmax=args.zmax)

        create_filelist(infiles, 'list.txt')
        staged_outfile = kw['outfile']
        run_gtapp('gtltcube', logger, kw)
        logger.info('cp %s %s', staged_outfile, outfile)
        shutil.copy(staged_outfile, outfile)

    os.chdir(cwd)
    logger.info('Deleting %s', tmpdir)
    shutil.rmtree(tmpdir)
    logger.info('Done.')
540122
def get_examples(examples_dir="examples/"):  # pragma: no cover
    """"""
    all_files = os.listdir(examples_dir)
    python_files = [f for f in all_files if is_python_file(f)]
    basenames = [remove_suffix(f) for f in python_files]
    modules = [import_module(module) for module in pathify(basenames)]
    return [
        module for module in modules
        if getattr(module, 'app', None) is not None
    ]
1154210
def usage(self):
        
        if self._usage is None:
            self._usage = UsageList(self._version, sim_sid=self._solution['sid'], )
        return self._usage
337939
public void printUsage() {
        String name = mainClass == null ? "<MainClass>" : mainClass.getName();
        String usage = "java " + name + " [OPTIONS]";
        final HelpFormatter formatter = new HelpFormatter();
        formatter.setWidth(120);
        formatter.printHelp(usage, options, true);
    }
1254483
def sample
      total, @usages = nil, {}
      timestamp = Time.now
      File.foreach('/proc/stat') do |line|
        case line
        when /^cpu[^\d]/
          next
        when CPU
          times = $~.captures
          processor_id = times[0] = times[0].to_i
          (1...times.size).each { |i| times[i] = times[i].to_f / USER_HZ }
          times << timestamp << timestamp
          @usages[processor_id] = Usage.new(self, *times)
        else
          break
        end
      end
      if @usages.empty?
        raise NoSampleDataError, "could not sample measurement data"
      end
      self
    end
438413
def usage(self, subcommand):
        
        usage = ' '.join(['%prog', subcommand, '[options]'])
        if self.args:
            usage = '%s %s' % (usage, str(self.args))
        return usage
1107853
def usage():
    

    print('Usage:', os.path.basename(sys.argv[0]), '[options]')
    print('Options:')
    print('        -k, --kval=<int>       Value k for generating k-PHP')
    print('                               Available values: [1 .. INT_MAX] (default = 1)')
    print('        -n, --size=<int>       Integer parameter of formula (its size)')
    print('                               Available values: [0 .. INT_MAX] (default = 8)')
    print('        -h, --help')
    print('        -t, --type=<string>    Formula type')
    print('                               Available values: cb, gt, par, php (default = php)')
    print('        -v, --verb             Be verbose (show comments)')
344807
def make_sample():
    
    if md_sample:
        # user has set another:
        return md_sample
    _md = []
    for hl in range(1, 7): _md.append('#' * hl + ' ' + 'Header %s' % hl)
    this = open(__file__).read().split('"""', 3)[2].splitlines()[:10]
    _md.append('```python\n""" Test """\n%s\n```' % '\n'.join(this).strip())
    _md.append("""
| Tables        | Fmt |
| -- | -- |
| !!! hint: wrapped | 0.1 **strong** |
    """)
    for ad in admons.keys()[:1]:
        _md.append('!!! %s: title\n    this is a %s\n' % (ad, ad.capitalize()))
    # 'this theme' replaced in the roller (but not at mdv w/o args):
    globals()['md_sample'] = \
            '\n'.join(_md) + '\n----\n!!! question: %s' % you_like
1253163
def isample(self, *args, **kwds):
        
        self._exc_info = None
        out = kwds.pop('out', sys.stdout)
        kwds['progress_bar'] = False

        def samp_targ(*args, **kwds):
            try:
                self.sample(*args, **kwds)
            except:
                self._exc_info = sys.exc_info()

        self._sampling_thread = Thread(
            target=samp_targ,
            args=args,
            kwargs=kwds)
        self.status = 'running'
        self._sampling_thread.start()
        self.iprompt(out=out)
377513
def record_example(self, example):
        
        self.num_examples += 1
        self.total_real_time += example.real_time
        self.total_user_time += example.user_time
        if not example.error:
            self.num_passed += 1
            self._write_example_passed(example)
        else:
            self.num_failed += 1
            self._write_example_failed(example)
            error = ErrorFormat(
                example.name, example.error, example.traceback,
                tuple(self.group_stack), example.stdout, example.stderr
            )
            self.errors.append(error)
        return not example.error
1190084
def mainloop(self):
        
        # Get client state
        proxy = config.engine.open()
        views = [x for x in sorted(proxy.view.list()) if x.startswith(self.PREFIX)]

        current_view = real_current_view = proxy.ui.current_view()
        if current_view not in views:
            if views:
                current_view = views[0]
            else:
                raise error.UserError("There are no '{}*' views defined at all!".format(self.PREFIX))

        # Check options
        if self.options.list:
            for name in sorted(views):
                print("{} {:5d} {}".format(
                    '*' if name == real_current_view else ' ',
                    proxy.view.size(xmlrpc.NOHASH, name),
                    name[self.PREFIX_LEN:]))

        elif self.options.next or self.options.prev or self.options.update:
            # Determine next in line
            if self.options.update:
                new_view = current_view
            else:
                new_view = (views * 2)[views.index(current_view) + (1 if self.options.next else -1)]

            self.LOG.info("{} category view '{}'.".format(
                "Updating" if self.options.update else "Switching to", new_view))

            # Update and switch to filtered view
            proxy.pyro.category.update(xmlrpc.NOHASH, new_view[self.PREFIX_LEN:])
            proxy.ui.current_view.set(new_view)

        else:
            self.LOG.info("Current category view is '{}'.".format(current_view[self.PREFIX_LEN:]))
            self.LOG.info("Use '--help' to get usage information.")
166353
def main():
    
    prog = sys.argv[0]

    arg_parser = create_parser(prog)

    opts = parse_cmdline(arg_parser)

    print('Parameters: server=%s\n username=%s\n namespace=%s\n'
          ' classname=%s\n max_pull_size=%s\n use_pull=%s' %
          (opts.server, opts.user, opts.namespace, opts.classname,
           opts.max_object_count, opts.usepull))

    # call method to connect to the server
    conn = WBEMConnection(opts.server, (opts.user, opts.password),
                          default_namespace=opts.namespace,
                          no_verification=True,
                          use_pull_operations=opts.usepull)

    #Call method to create iterator
    instances = []
    try:
        iter_instances = conn.IterEnumerateInstances(
            opts.classname,
            MaxObjectCount=opts.max_object_count)

        # generate instances with
        for instance in iter_instances:
            print(' %s %s' % (type(instances), type(instance)))
            instances.append(instance)
            print('\npath=%s\n%s' % (instance.path, instance.tomof()))

    # handle exceptions
    except CIMError as ce:
        print('Operation Failed: CIMError: code=%s, Description=%s' %
              (ce.status_code_name, ce.status_description))
        sys.exit(1)
    except Error as err:
        print ("Operation failed: %s" % err)
        sys.exit(1)

    inst_paths = [inst.path for inst in instances]

    paths = []
    try:
        iter_paths = conn.IterEnumerateInstancePaths(
            opts.classname,
            MaxObjectCount=opts.max_object_count)

        # generate instances with
        for path in iter_paths:
            print('path=%s' % path)
            paths.append(path)

        if len(paths) != len(paths):
            print('Error path and enum response sizes different enum=%s path=%s'
                  % (len(paths), len(paths)))
        for path in paths:
            found = False
            for inst_path in inst_paths:                
                if path == inst_path:
                    found = True
                    break
                else:
                    print('No match \n%s\n%s' %(path, inst_path))
            if not found:
                print('Path %s not found in insts' % path)
    # handle exceptions
    except CIMError as ce:
        print('Operation Failed: CIMError: code=%s, Description=%s' %
              (ce.status_code_name, ce.status_description))
        sys.exit(1)
    except Error as err:
        print ("Operation failed: %s" % err)
        sys.exit(1)

    return 0
1267107
def main(args=sys.argv):
    
    usage = USAGE % ((args[0],) * 6)

    try:
        popts, args = getopt.getopt(args[1:], "l:f:F:o:O:P:LS:a:N:vhVHgsx")
    except getopt.GetoptError:
        print(usage, file=sys.stderr)
        return 2

    try:
        return main_inner(popts, args, usage)
    except Exception:
        if '-v' in dict(popts):
            print(file=sys.stderr)
            print('*' * 65, file=sys.stderr)
            print('An unhandled exception occurred while highlighting.',
                  file=sys.stderr)
            print('Please report the whole traceback to the issue tracker at',
                  file=sys.stderr)
            print('<https://bitbucket.org/birkenfeld/pygments-main/issues>.',
                  file=sys.stderr)
            print('*' * 65, file=sys.stderr)
            print(file=sys.stderr)
            raise
        import traceback
        info = traceback.format_exception(*sys.exc_info())
        msg = info[-1].strip()
        if len(info) >= 3:
            # extract relevant file and position info
            msg += '\n   (f%s)' % info[-2].split('\n')[0].strip()[1:]
        print(file=sys.stderr)
        print('*** Error while highlighting:', file=sys.stderr)
        print(msg, file=sys.stderr)
        print('*** If this is a bug you want to report, please rerun with -v.',
              file=sys.stderr)
        return 1