Dump commands wrapper for external access.
330534
def dump_commands(self, commands):
        """"""
        # Get base directory
        directory = os.path.join(os.path.dirname(self.sql_script), 'fails')

        # Get file name to be used for folder name
        fname = os.path.basename(self.sql_script.rsplit('.')[0])

        return dump_commands(commands, directory, fname)
1083866
def get_external_command_output(command: str) -> bytes:
    
    args = shlex.split(command)
    ret = subprocess.check_output(args)  # this needs Python 2.7 or higher
    return ret
521640
def pipe_commands_to_file(cmds, path, extra_env=None, show_stderr=False):
    
    env = extend_env(extra_env) if extra_env else None
    env_str = (get_env_str(extra_env) + ' ') if extra_env else ''
    cmd_strs = [env_str + ' '.join(cmd) for cmd in cmds]

    logger.info('Saving output of `{0}`'.format(' | '.join(cmd_strs)))

    with open('/dev/null', 'w') as NULL:
        # Start processes
        processes = []
        for cmd_str, cmd in zip(cmd_strs, cmds):
            p_stdin = processes[-1][1].stdout if processes else None
            p_stderr = None if show_stderr else NULL

            p = Popen(cmd, env=env, stdout=PIPE, stdin=p_stdin, stderr=p_stderr)
            processes.append((cmd_str, p))

        p_last = processes[-1][1]

        with open(path, 'wb') as f:
            shutil.copyfileobj(p_last.stdout, f)

            # Close processes
            error = False
            for cmd_str, p in processes:
                p.stdout.close()
                if p.wait() != 0:
                    error = True
            if error:
                raise CalledProcessError(cmd=cmd_str, returncode=p.returncode)
789001
def dumps(self):
        """"""

        ret_str = self.path_type

        if self.options is not None:
            ret_str += self.options.dumps()

        return ret_str
892303
def dump
      {
          'args'            => self.args,
          'worker'          => self.worker,
          'queue'           => self.queue,

          'status'          => self.status,
          'at'              => self.at,
          'total'           => self.total,
          'message'         => self.message,

          'payload'         => self.payload,
          'last_updated_at' => Time.now.to_i
      }
    end
1198234
def dump(self, name: str, inst):
        ""
        self.stash.dump(name, inst)
357720
def main_dump(paths, directory, dry_run):
    
    table_map = get_table_map(paths)

    for conn_name, conn_info in table_map.items():
        inter = conn_info["interface"]
        conn = inter.connection_config
        table_names = conn_info["table_names"]

        cmd = get_base_cmd("backup", inter, directory)
        cmd.extend(table_names)

        if dry_run:
            echo.out(" ".join(cmd))

        else:
            run_cmd(cmd)
496488
def dumps(self):
        

        args = [self.size, self.align, self.dumps_content()]
        string = Command(self.latex_name, args).dumps()

        return string
1167484
def dumpdata(app_target, *args, **kwargs):
    """"""
    options = {
        '--indent': 4,
    }
    options.update(kwargs)

    # Quiet down pynt...
    logger = logging.getLogger('pynt')
    logger.propagate = False

    project.execute_manage('dumpdata', app_target, *args, **options)
672930
def call_out(command):
  
  # start external command process
  p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

  # get outputs
  out, _ = p.communicate()

  return p.returncode, out.strip()
119706
def _dump(self):
        """"""
        pp = pprint.PrettyPrinter(indent=4)

        print("=== Variables ===")
        print("-- Globals --")
        pp.pprint(self._global)
        print("-- Bot vars --")
        pp.pprint(self._var)
        print("-- Substitutions --")
        pp.pprint(self._sub)
        print("-- Person Substitutions --")
        pp.pprint(self._person)
        print("-- Arrays --")
        pp.pprint(self._array)

        print("=== Topic Structure ===")
        pp.pprint(self._topics)
        print("=== %Previous Structure ===")
        pp.pprint(self._thats)

        print("=== Includes ===")
        pp.pprint(self._includes)

        print("=== Inherits ===")
        pp.pprint(self._lineage)

        print("=== Sort Buffer ===")
        pp.pprint(self._sorted)

        print("=== Syntax Tree ===")
        pp.pprint(self._syntax)
1136492
def table_dump(self, table):
        """"""
        if not table: raise ValueError("no table")

        print('------- dumping table {}'.format(table))
        pipes = ["gzip"]
        outfile_path = self._get_outfile_path(table)
        cmd = self._get_args(
            "pg_dump",
            "--table={}".format(table),
            #"--data-only",
            "--clean",
            "--no-owner",
            "--column-inserts",
        )
        cmd = ' '.join(cmd)
        cmd += ' | {}'.format(' | '.join(pipes))
        cmd += ' > {}'.format(outfile_path)

        self._run_cmd(cmd)
        print('------- dumped table {}'.format(table))
        return True
826743
def get_output(script):
    """"""
    with logs.debug_time(u'Read output from external shell logger'):
        commands = _get_last_n(const.SHELL_LOGGER_LIMIT)
        for command in commands:
            if command['command'] == script:
                lines = _get_output_lines(command['output'])
                output = '\n'.join(lines).strip()
                return output
            else:
                logs.warn("Output isn't available in shell logger")
                return None
32147
def extract_arj (archive, compression, cmd, verbosity, interactive, outdir):
    """"""
    cmdlist = [cmd, 'x', '-r']
    if not interactive:
        cmdlist.append('-y')
    cmdlist.extend([archive, outdir])
    return cmdlist
1049068
def dump(self, **kwargs):
    """"""

    f = io.StringIO()
    w = Writer(f, self.keys, **kwargs)
    w.write(self)
    text = f.getvalue().lstrip()
    f.close()

    return text
710836
def dump(data, **kwds):
    """"""
    if _usedefaultyamlloader:
        return yaml.safe_dump(data, **kwds)
    else:
        return odyldo.safe_dump(data, **kwds)
696465
def dumps(self, script):
        ""
        string = BytesIO()
        self._dump(script, string, self._protocol, self._version)
        return string.getvalue()