Build FTP client.
199973
def _build_ftp_client(cls, session: AppSession):
        ''''''
        return session.factory.new(
            'FTPClient',
            connection_pool=session.factory['ConnectionPool'],
            # TODO: recorder
            # recorder=session.factory['DemuxRecorder'],
        )
46865
private AFTPClient actionOpen() throws IOException, PageException {
	required("server", server);
	required("username", username);
	// required("password", password);

	AFTPClient client = getClient();
	writeCfftp(client);
	return client;
    }
247534
def _get_ftp(url, temp_file_name, initial_size, file_size, verbose_bool,
             progressbar, ncols=80):
    """"""
    # Adapted from: https://pypi.python.org/pypi/fileDownloader.py
    # but with changes

    parsed_url = urllib.parse.urlparse(url)
    file_name = os.path.basename(parsed_url.path)
    server_path = parsed_url.path.replace(file_name, "")
    unquoted_server_path = urllib.parse.unquote(server_path)

    data = ftplib.FTP()
    if parsed_url.port is not None:
        data.connect(parsed_url.hostname, parsed_url.port)
    else:
        data.connect(parsed_url.hostname)
    data.login()
    if len(server_path) > 1:
        data.cwd(unquoted_server_path)
    data.sendcmd("TYPE I")
    data.sendcmd("REST " + str(initial_size))
    down_cmd = "RETR " + file_name
    assert file_size == data.size(file_name)
    if progressbar:
        progress = tqdm(total=file_size, initial=initial_size,
                        desc='file_sizes', ncols=ncols, unit='B',
                        unit_scale=True)
    else:
        progress = None

    # Callback lambda function that will be passed the downloaded data
    # chunk and will write it to file and update the progress bar
    mode = 'ab' if initial_size > 0 else 'wb'
    with open(temp_file_name, mode) as local_file:
        def chunk_write(chunk):
            return _chunk_write(chunk, local_file, progress)
        data.retrbinary(down_cmd, chunk_write)
        data.close()
1191350
def setup(self):
        
        r = self.call_ext_prog(self.get_option("script"))
        if r['status'] == 0:
            tarfile = ""
            for line in r['output']:
                line = line.strip()
                tarfile = self.do_regex_find_all(r"ftp (.*tar.gz)", line)
            if len(tarfile) == 1:
                self.add_copy_spec(tarfile[0])
481962
def build(self, shutit):
		
		if shutit.build['delivery'] in ('docker','dockerfile'):
			if shutit.get_current_shutit_pexpect_session_environment().install_type == 'apt':
				shutit.add_to_bashrc('export DEBIAN_FRONTEND=noninteractive')
				if not shutit.command_available('lsb_release'):
					shutit.install('lsb-release')
				shutit.lsb_release()
			elif shutit.get_current_shutit_pexpect_session_environment().install_type == 'yum':
				# yum updates are so often "bad" that we let exit codes of 1 through.
				# TODO: make this more sophisticated
				shutit.send('yum update -y', timeout=9999, exit_values=['0', '1'])
			shutit.pause_point('Anything you want to do to the target host ' + 'before the build starts?', level=2)
		return True
657714
private function ftp()
    {
        $servers = static::SERVERS;  // Server list
        // Try each server till success
        $ftp;
        for ($i = 0; $i < count($servers); $i++) {
            $ftpServer = $servers[$i]['domain'];
            $ftp       = ftp_connect($ftpServer);

            // Return resource on connected
            if ($ftp) {
                if (ftp_login($ftp, 'anonymous', null)) {
                    if (ftp_chdir($ftp, $servers[$i]['path'])) {
                        if (ftp_pasv($ftp, true)) {
                            return $ftp;
                        }
                    }
                }
            }
        }

        // Unable to connect to a server
        throw new \Exception('Unable to connect to server to download data');
    }
1240436
function getClient(credentials) {
	return new Promise((resolve, reject) => {
		const ftp = new Ftp(credentials);
		ftp.once('connect', () => {
			resolve(ftp);
		});
	});
}
615507
def build(client, repository_tag, docker_file, tag=None, use_cache=False):
        
        if not isinstance(client, docker.Client):
            raise TypeError("client needs to be of type docker.Client.")

        if not isinstance(docker_file, six.string_types) or not os.path.exists(docker_file):
            # TODO: need to add path stuff for git and http etc.
            raise Exception("docker file path doesn't exist: {0}".format(docker_file))

        if not isinstance(repository_tag, six.string_types):
            raise TypeError('repository must be a string')

        if not tag:
            tag = 'latest'

        if not isinstance(use_cache, bool):
            raise TypeError("use_cache must be a bool. {0} was passed.".format(use_cache))

        no_cache = not use_cache

        if ':' not in repository_tag:
            repository_tag = "{0}:{1}".format(repository_tag, tag)
        file_obj = None
        try:
            if os.path.isfile(docker_file):
                path = os.getcwd()
                docker_file = "./{0}".format(os.path.relpath(docker_file))

                # TODO: support using file_obj in the future. Needed for post pre hooks and the injector.
                # with open(docker_file) as Dockerfile:
                #     testing = Dockerfile.read()
                #     file_obj = BytesIO(testing.encode('utf-8'))

                response = client.build(
                    path=path,
                    nocache=no_cache,
                    # custom_context=True,
                    dockerfile=docker_file,
                    # fileobj=file_obj,
                    tag=repository_tag,
                    rm=True,
                    stream=True
                )
            else:
                response = client.build(path=docker_file, tag=repository_tag, rm=True, nocache=no_cache, stream=True)
        except Exception as e:
            raise e
        finally:
            if file_obj:
                file_obj.close()

        parse_stream(response)
        client.close()

        return Image(client, repository_tag)
120746
def run():
    """"""

    # Use print() instead of logging when running in CLI mode:
    set_pyftpsync_logger(None)

    parser = argparse.ArgumentParser(
        description="Synchronize folders over FTP.",
        epilog="See also https://github.com/mar10/pyftpsync",
        parents=[verbose_parser],
    )

    # Note: we want to allow --version to be combined with --verbose. However
    # on Py2, argparse makes sub-commands mandatory, unless `action="version"` is used.
    if check_cli_verbose(3) > 3:
        version_info = "pyftpsync/{} Python/{} {}".format(
            __version__, PYTHON_VERSION, platform.platform()
        )
    else:
        version_info = "{}".format(__version__)

    parser.add_argument("-V", "--version", action="version", version=version_info)

    subparsers = parser.add_subparsers(help="sub-command help")

    # --- Create the parser for the "upload" command ---------------------------

    sp = subparsers.add_parser(
        "upload",
        parents=[verbose_parser, common_parser, matcher_parser, creds_parser],
        help="copy new and modified files to remote folder",
    )

    sp.add_argument(
        "local",
        metavar="LOCAL",
        default=".",
        help="path to local folder (default: %(default)s)",
    )
    sp.add_argument("remote", metavar="REMOTE", help="path to remote folder")
    sp.add_argument(
        "--force",
        action="store_true",
        help="overwrite remote files, even if the target is newer "
        "(but no conflict was detected)",
    )
    sp.add_argument(
        "--resolve",
        default="ask",
        choices=["local", "skip", "ask"],
        help="conflict resolving strategy (default: '%(default)s')",
    )
    sp.add_argument(
        "--delete",
        action="store_true",
        help="remove remote files if they don't exist locally",
    )
    sp.add_argument(
        "--delete-unmatched",
        action="store_true",
        help="remove remote files if they don't exist locally "
        "or don't match the current filter (implies '--delete' option)",
    )

    sp.set_defaults(command="upload")

    # --- Create the parser for the "download" command -------------------------

    sp = subparsers.add_parser(
        "download",
        parents=[verbose_parser, common_parser, matcher_parser, creds_parser],
        help="copy new and modified files from remote folder to local target",
    )

    sp.add_argument(
        "local",
        metavar="LOCAL",
        default=".",
        help="path to local folder (default: %(default)s)",
    )
    sp.add_argument("remote", metavar="REMOTE", help="path to remote folder")
    sp.add_argument(
        "--force",
        action="store_true",
        help="overwrite local files, even if the target is newer "
        "(but no conflict was detected)",
    )
    sp.add_argument(
        "--resolve",
        default="ask",
        choices=["remote", "skip", "ask"],
        help="conflict resolving strategy (default: '%(default)s')",
    )
    sp.add_argument(
        "--delete",
        action="store_true",
        help="remove local files if they don't exist on remote target",
    )
    sp.add_argument(
        "--delete-unmatched",
        action="store_true",
        help="remove local files if they don't exist on remote target "
        "or don't match the current filter (implies '--delete' option)",
    )

    sp.set_defaults(command="download")

    # --- Create the parser for the "sync" command -----------------------------

    sp = subparsers.add_parser(
        "sync",
        parents=[verbose_parser, common_parser, matcher_parser, creds_parser],
        help="synchronize new and modified files between remote folder and local target",
    )

    sp.add_argument(
        "local",
        metavar="LOCAL",
        default=".",
        help="path to local folder (default: %(default)s)",
    )
    sp.add_argument("remote", metavar="REMOTE", help="path to remote folder")
    sp.add_argument(
        "--resolve",
        default="ask",
        choices=["old", "new", "local", "remote", "skip", "ask"],
        help="conflict resolving strategy (default: '%(default)s')",
    )

    sp.set_defaults(command="sync")

    # --- Create the parser for the "run" command -----------------------------

    add_run_parser(subparsers)

    # --- Create the parser for the "scan" command -----------------------------

    add_scan_parser(subparsers)

    # --- Parse command line ---------------------------------------------------

    args = parser.parse_args()

    args.verbose -= args.quiet
    del args.quiet

    # print("verbose", args.verbose)

    ftp_debug = 0
    if args.verbose >= 6:
        ftp_debug = 1

    # Modify the `args` from the `pyftpsync.yaml` config:
    if getattr(args, "command", None) == "run":
        handle_run_command(parser, args)

    if callable(getattr(args, "command", None)):
        # scan_handler
        try:
            return args.command(parser, args)
        except KeyboardInterrupt:
            print("\nAborted by user.", file=sys.stderr)
            sys.exit(3)

    elif not hasattr(args, "command"):
        parser.error(
            "missing command (choose from 'upload', 'download', 'run', 'sync', 'scan')"
        )

    # Post-process and check arguments
    if hasattr(args, "delete_unmatched") and args.delete_unmatched:
        args.delete = True

    args.local_target = make_target(args.local, {"ftp_debug": ftp_debug})

    if args.remote == ".":
        parser.error("'.' is expected to be the local target (not remote)")
    args.remote_target = make_target(args.remote, {"ftp_debug": ftp_debug})
    if not isinstance(args.local_target, FsTarget) and isinstance(
        args.remote_target, FsTarget
    ):
        parser.error("a file system target is expected to be local")

    # Let the command handler do its thing
    opts = namespace_to_dict(args)
    if args.command == "upload":
        s = UploadSynchronizer(args.local_target, args.remote_target, opts)
    elif args.command == "download":
        s = DownloadSynchronizer(args.local_target, args.remote_target, opts)
    elif args.command == "sync":
        s = BiDirSynchronizer(args.local_target, args.remote_target, opts)
    else:
        parser.error("unknown command '{}'".format(args.command))

    s.is_script = True

    try:
        s.run()
    except KeyboardInterrupt:
        print("\nAborted by user.", file=sys.stderr)
        sys.exit(3)
    finally:
        # Prevent sporadic exceptions in ftplib, when closing in __del__
        s.local.close()
        s.remote.close()

    stats = s.get_stats()
    if args.verbose >= 5:
        pprint(stats)
    elif args.verbose >= 1:
        if args.dry_run:
            print("(DRY-RUN) ", end="")
        print(
            "Wrote {}/{} files in {} directories, skipped: {}.".format(
                stats["files_written"],
                stats["local_files"],
                stats["local_dirs"],
                stats["conflict_files_skipped"],
            ),
            end="",
        )
        if stats["interactive_ask"]:
            print()
        else:
            print(" Elap: {}.".format(stats["elap_str"]))

    return
795502
def ftp_walk(ftpconn: FTP, rootpath=''):
    """"""

    current_directory = rootpath

    try:
        directories, files = directory_listing(ftpconn, current_directory)
    except ftplib.error_perm:
        return

    # Yield before recursion
    yield current_directory, directories, files

    # Recurse into sub-directories
    for name in directories:
        new_path = os.path.join(current_directory, name)

        for entry in ftp_walk(ftpconn, rootpath=new_path):
            yield entry
    else:
        return
1327161
def build_files(outdir):
    """"""
    # Make sure there is actually a configuration file
    config_file_dir = os.path.join(cwd, "config.py")
    if not os.path.exists(config_file_dir):
        sys.exit(
            "There dosen't seem to be a configuration file. Have you run the init command?")
    else:
        sys.path.insert(0, cwd)
        try:
            from config import website_name, website_description, website_language, home_page_list
        except:
            sys.exit(
                "ERROR: Some of the crucial configuration values could not be found! Maybe your config.py is too old. Run 'blended init' to fix.")
        try:
            from config import website_description_long, website_license, website_url, author_name, author_bio, plugins, minify_css, minify_js, custom_variables
        except:
            website_description_long = ""
            website_license = ""
            website_url = ""
            author_name = ""
            author_bio = ""
            plugins = []
            custom_variables = {}
            minify_css = False
            minify_js = False
            print("WARNING: Some of the optional configuration values could not be found! Maybe your config.py is too old. Run 'blended init' to fix.\n")

    # Create the build folder
    build_dir = os.path.join(cwd, outdir)
    if "." not in outdir and ".." not in outdir and "..." not in outdir and "...." not in outdir and "....." not in outdir:
        replace_folder(build_dir)

    # Make sure there is actually a header template file
    header_file_dir = os.path.join(cwd, "templates", "header.html")
    if not os.path.exists(header_file_dir):
        sys.exit(
            "There dosen't seem to be a header template file. You need one to generate.")

    # Make sure there is actually a footer template file
    footer_file_dir = os.path.join(cwd, "templates", "footer.html")
    if not os.path.exists(footer_file_dir):
        sys.exit(
            "There dosen't seem to be a footer template file. You need one to generate.")

    # Open the header and footer files for reading
    header_file = open(header_file_dir, "r")
    footer_file = open(footer_file_dir, "r")

    # Create the HTML page listing
    page_list_item_file = os.path.join(cwd, "templates", "page_list_item.html")
    if not os.path.exists(page_list_item_file):
        page_list = '<ul class="page-list">\n'
        for root, dirs, files in os.walk(os.path.join(cwd, "content")):
            for filename in files:
                top = os.path.dirname(os.path.join(root, filename))
                top2 = top.replace(os.path.join(cwd, "content"), "", 1)
                if platform != "win32":
                    subfolder = top2.replace("/", "", 1)
                else:
                    subfolder = top2.replace("\\", "", 1)

                if subfolder == "":
                    subfolder_link = ""
                else:
                    subfolder_link = subfolder + "/"
                file_modified = time.ctime(
                    os.path.getmtime(os.path.join(root, filename)))
                newFilename = get_html_filename(filename)
                newFilename2 = get_html_clear_filename(filename)
                page_list = page_list + '<li class="page-list-item"><a href="' + subfolder_link + newFilename + \
                    '">' + newFilename2 + '</a><span class="page-list-item-time"> - ' + \
                    str(file_modified) + '</span></li>\n'
        page_list = page_list + '</ul>'
    else:
        with open(page_list_item_file, 'r') as f:
            page_list_item = f.read()

        page_list = ""
        for root, dirs, files in os.walk(os.path.join(cwd, "content")):
            dirs[:] = [d for d in dirs if "_" not in d]
            for filename in files:
                p_content = convert_text(os.path.join(root, filename))
                top = os.path.dirname(os.path.join(root, filename))
                top2 = top.replace(os.path.join(cwd, "content"), "", 1)
                if platform != "win32":
                    subfolder = top2.replace("/", "", 1)
                else:
                    subfolder = top2.replace("\\", "", 1)

                if subfolder == "":
                    subfolder_link = ""
                else:
                    subfolder_link = subfolder + "/"
                file_modified = time.ctime(
                    os.path.getmtime(os.path.join(root, filename)))
                file_modified_day = str(datetime.strptime(
                file_modified, "%a %b %d %H:%M:%S %Y"))[8:10]
                file_modified_year = str(datetime.strptime(
                    file_modified, "%a %b %d %H:%M:%S %Y"))[:4]
                file_modified_month = str(datetime.strptime(
                    file_modified, "%a %b %d %H:%M:%S %Y"))[5:7]
                month_name = calendar.month_name[int(file_modified_month)]
                newFilename = get_html_filename(filename)
                newFilename2 = get_html_clear_filename(filename)

                page_list = page_list + page_list_item.replace("{path}", subfolder_link + newFilename).replace("{name}", newFilename2).replace(
                    "{date}", str(file_modified)).replace("{content}", p_content).replace("{content_short}", p_content[:250] + "...").replace("{day}", file_modified_day).replace("{month}", file_modified_month).replace("{month_name}", month_name).replace("{year}", file_modified_year)

    if home_page_list == "yes" or home_page_list:
        # Open the home page file (index.html) for writing
        home_working_file = open(os.path.join(cwd, outdir, "index.html"), "w")

        home_working_file.write(header_file.read())

        # Make sure there is actually a home page template file
        home_templ_dir = os.path.join(cwd, "templates", "home_page.html")
        if os.path.exists(home_templ_dir):
            home_templ_file = open(home_templ_dir, "r")
            home_working_file.write(home_templ_file.read())
        else:
            print("\nNo home page template file found. Writing page list to index.html")
            home_working_file.write(page_list)

        home_working_file.write(footer_file.read())

        home_working_file.close()

    for root, dirs, files in os.walk(os.path.join(cwd, "content")):
        dirs[:] = [d for d in dirs if "_" not in d]
        for filename in files:
            if not filename.startswith("_"):
                header_file = open(header_file_dir, "r")
                footer_file = open(footer_file_dir, "r")
                newFilename = get_html_filename(filename)

                top = os.path.dirname(os.path.join(root, filename))
                top2 = top.replace(os.path.join(cwd, "content"), "", 1)
                if platform != "win32":
                    subfolder = top2.replace("/", "", 1)
                else:
                    subfolder = top2.replace("\\", "", 1)

                if subfolder == "":
                    currents_working_file = open(
                        os.path.join(cwd, outdir, newFilename), "w")
                else:
                    create_folder(os.path.join(cwd, outdir, subfolder))
                    currents_working_file = open(os.path.join(
                        cwd, outdir, subfolder, newFilename), "w")

                # Write the header
                currents_working_file.write(header_file.read())

                text_cont1 = convert_text(os.path.join(root, filename))

                if "+++++" in text_cont1.splitlines()[1]:
                    page_template_file = text_cont1.splitlines()[0]
                    text_cont1 = text_cont1.replace(
                        text_cont1.splitlines()[0], "")
                    text_cont1 = text_cont1.replace(
                        text_cont1.splitlines()[1], "")
                else:
                    page_template_file = "content_page"

                # Write the text content into the content template and onto the
                # build file
                content_templ_dir = os.path.join(
                    cwd, "templates", page_template_file + ".html")
                if os.path.exists(content_templ_dir):
                    content_templ_file = open(content_templ_dir, "r")
                    content_templ_file1 = content_templ_file.read()
                    content_templ_file2 = content_templ_file1.replace(
                        "{page_content}", text_cont1)
                    currents_working_file.write(content_templ_file2)
                else:
                    currents_working_file.write(text_cont1)

                # Write the footer to the build file
                currents_working_file.write("\n" + footer_file.read())

                # Close the build file
                currents_working_file.close()

    # Find all the nav(something) templates in the `templates` folder and
    # Read their content to the dict
    navs = {}

    for file in os.listdir(os.path.join(cwd, "templates")):
        if "nav" in file:
            nav_cont = open(os.path.join(cwd, "templates", file), "r")
            navs[file.replace(".html", "")] = nav_cont.read()
            nav_cont.close()

    forbidden_dirs = set(["assets", "templates"])
    blended_version_message = "Built with Blended v" + \
        str(app_version)
    build_date = str(datetime.now().date())
    build_time = str(datetime.now().time())
    build_datetime = str(datetime.now())

    # Replace global variables such as site name and language
    for root, dirs, files in os.walk(os.path.join(cwd, outdir)):
        dirs[:] = [d for d in dirs if d not in forbidden_dirs]
        for filename in files:
            if filename != "config.pyc" and filename != "config.py":
                newFilename = get_html_clear_filename(filename)
                page_file = filename.replace(".html", "")
                page_folder = os.path.basename(os.path.dirname(os.path.join(
                    root, filename))).replace("-", "").replace("_", "").title()
                page_folder_orig = os.path.basename(
                    os.path.dirname(os.path.join(root, filename)))
                top = os.path.dirname(os.path.join(root, filename))
                top2 = top.replace(os.path.join(cwd, outdir), "", 1)
                if platform != "win32":
                    subfolder = top2.replace("/", "", 1)
                else:
                    subfolder = top2.replace("\\", "", 1)
                if subfolder == "":
                    subfolder_folder = os.path.join(cwd, outdir, filename)
                else:
                    subfolder_folder = os.path.join(
                        cwd, outdir, subfolder, filename)
                file_modified = time.ctime(
                    os.path.getmtime(os.path.join(root, filename)))
                file_modified_day = str(datetime.strptime(
                    file_modified, "%a %b %d %H:%M:%S %Y"))[8:10]
                file_modified_year = str(datetime.strptime(
                    file_modified, "%a %b %d %H:%M:%S %Y"))[:4]
                file_modified_month = str(datetime.strptime(
                file_modified, "%a %b %d %H:%M:%S %Y"))[5:7]
                month_name = calendar.month_name[int(file_modified_month)]

                # The Loop!
                for line in fileinput.input(subfolder_folder, inplace=1):
                    for var in custom_variables:
                        line = line.replace(
                            "{" + var + "}", custom_variables[var])
                    if len(plugins) != 0:
                        for i in range(len(plugins)):
                            if sys.version_info[0] < 2:
                                main = importlib.import_module(plugins[i])
                            elif sys.version_info[0] < 3:
                                main = __import__(plugins[i])
                            content = main.main()
                            line = line.replace(
                                "{" + plugins[i] + "}", content)
                    if "{nav" in line:
                        navname = line.split("{")[1].split("}")[0]
                        line = line.replace(
                            "{" + navname + "}", navs[(line.split("{"))[1].split("}")[0]])
                    line = line.replace(
                        "{website_description}", website_description)
                    line = line.replace(
                        "{website_description_long}", website_description_long)
                    line = line.replace("{website_license}", website_license)
                    line = line.replace("{website_language}", website_language)
                    line = line.replace("{website_url}", website_url)
                    line = line.replace("{author_name}", author_name)
                    line = line.replace("{author_bio}", author_bio)
                    line = line.replace("{random_number}",
                                        str(randint(0, 100000000)))
                    line = line.replace("{build_date}", build_date)
                    line = line.replace("{build_time}", build_time)
                    line = line.replace("{build_datetime}", build_datetime)
                    line = line.replace("{page_list}", page_list)
                    line = line.replace("{page_name}", newFilename)
                    line = line.replace("{page_filename}", page_file)
                    line = line.replace("{page_file}", filename)
                    line = line.replace("{" + filename + "_active}", "active")
                    if page_folder != outdir.title():
                        line = line.replace("{page_folder}", page_folder)
                    else:
                        line = line.replace("{page_folder}", "")
                    if page_folder_orig != outdir:
                        line = line.replace(
                            "{page_folder_orig}", page_folder_orig)
                    else:
                        line = line.replace("{page_folder_orig}", "")
                    line = line.replace("{page_date}", str(file_modified))
                    line = line.replace("{page_day}", str(file_modified_day))
                    line = line.replace("{page_year}", str(file_modified_year))
                    line = line.replace(
                        "{page_month}", str(file_modified_month))
                    line = line.replace(
                        "{page_month_name}", str(month_name))
                    line = line.replace("{blended_version}", str(app_version))
                    line = line.replace(
                        "{blended_version_message}", blended_version_message)
                    line = line.replace("{website_name}", website_name)
                    top = os.path.join(cwd, outdir)
                    startinglevel = top.count(os.sep)
                    relative_path = ""
                    level = root.count(os.sep) - startinglevel
                    for i in range(level):
                        relative_path = relative_path + "../"
                    line = line.replace("{relative_root}", relative_path)
                    print(line.rstrip('\n'))
                fileinput.close()

    # Copy the asset folder to the build folder
    if os.path.exists(os.path.join(cwd, "templates", "assets")):
        if os.path.exists(os.path.join(cwd, outdir, "assets")):
            shutil.rmtree(os.path.join(cwd, outdir, "assets"))
        shutil.copytree(os.path.join(cwd, "templates", "assets"),
                        os.path.join(cwd, outdir, "assets"))

    for root, dirs, files in os.walk(os.path.join(cwd, outdir, "assets")):
        for file in files:
            if not file.startswith("_"):
                if (file.endswith(".sass")) or (file.endswith(".scss")):
                    sass_text = open(os.path.join(root, file)).read()
                    text_file = open(os.path.join(
                        root, file[:-4] + "css"), "w")
                    if sass_text != "":
                        text_file.write(sass.compile(string=sass_text))
                    else:
                        print(file + " is empty! Not compiling Sass.")
                    text_file.close()
                if file.endswith(".less"):
                    less_text = open(os.path.join(root, file)).read()
                    text_file = open(os.path.join(
                        root, file[:-4] + "css"), "w")
                    if less_text != "":
                        text_file.write(lesscpy.compile(StringIO(less_text)))
                    else:
                        print(file + " is empty! Not compiling Less.")
                    text_file.close()
                if file.endswith(".styl"):
                    try:
                        styl_text = open(os.path.join(root, file)).read()
                        text_file = open(os.path.join(
                            root, file[:-4] + "css"), "w")
                        if styl_text != "":
                            text_file.write(Stylus().compile(styl_text))
                        else:
                            print(file + " is empty! Not compiling Styl.")
                        text_file.close()
                    except:
                        print("Not able to build with Stylus! Is it installed?")
                        try:
                            subprocess.call["npm", "install", "-g", "stylus"]
                        except:
                            print("NPM (NodeJS) not working. Is it installed?")
                if file.endswith(".coffee"):
                    coffee_text = open(os.path.join(root, file)).read()
                    text_file = open(os.path.join(root, file[:-6] + "js"), "w")
                    if coffee_text != "":
                        text_file.write(coffeescript.compile(coffee_text))
                    else:
                        print(file + " is empty! Not compiling CoffeeScript.")
                    text_file.close()
                if minify_css:
                    if file.endswith(".css"):
                        css_text = open(os.path.join(root, file)).read()
                        text_file = open(os.path.join(root, file), "w")
                        if css_text != "":
                            text_file.write(cssmin(css_text))
                        text_file.close()
                if minify_js:
                    if file.endswith(".js"):
                        js_text = open(os.path.join(root, file)).read()
                        text_file = open(os.path.join(root, file), "w")
                        if js_text != "":
                            text_file.write(jsmin(js_text))
                        text_file.close()
992570
def build(python=PYTHON):
    """"""
    clean()
    local(
        "LIBRARY_PATH={library_path} CPATH={include_path} {python} "
        "setup.py build_ext --inplace".format(
            library_path=LIBRARY_PATH,
            include_path=INCLUDE_PATH,
            python=python,
        ))
207702
Function<TcpServer, TcpServer> build() {
		HttpRequestDecoderSpec decoder = new HttpRequestDecoderSpec();
		decoder.initialBufferSize = initialBufferSize;
		decoder.maxChunkSize = maxChunkSize;
		decoder.maxHeaderSize = maxHeaderSize;
		decoder.maxInitialLineLength = maxInitialLineLength;
		decoder.validateHeaders = validateHeaders;
		return tcp -> tcp.bootstrap(b -> HttpServerConfiguration.decoder(b, decoder));
	}
778520
def _work(self):
        """"""
        server = wsgi.Server(
            name=self._AGENT_BINARY,
            num_threads=CONF.AGENT.worker_count)
        server.start(
            application=_MetadataProxyHandler(),
            port=CONF.bind_port,
            host=CONF.bind_host)
        server.wait()
323217
def build_mxnet(app):
    """"""
    if not os.path.exists(os.path.join(app.builder.srcdir, '..', 'config.mk')):
        _run_cmd("cd %s/.. && cp make/config.mk config.mk && make -j$(nproc) USE_MKLDNN=0 USE_CPP_PACKAGE=1 " %
                app.builder.srcdir)
    else:
        _run_cmd("cd %s/.. && make -j$(nproc) USE_MKLDNN=0 USE_CPP_PACKAGE=1 " %
                app.builder.srcdir)
350476
def build(self, dest=None):
        ""
        # dest can be set here or on init
        if not dest:
            dest = self.dest

        # raise an error if dest is None
        if dest is None:
            raise ValueError('destination directory must not be None')

        # store build dir for later
        self.dest = dest

        # ensure a build dir
        if not os.path.isdir(self.dest):
            os.makedirs(self.dest)

        # make sure we have files
        if not self.files:
            self.run()

        # write the content of each post to dest, using keys as filenames
        for filename, post in self.files.items():

            # join filename to dest dir
            path = os.path.join(self.dest, filename)
            with open(path, 'wb') as f:
                f.write(post.content.encode('utf-8'))
1140835
def connect(self):
        
        self._build_socket()
        self._connect_socket()
        self._build_file_socket()
        self._send_connect_msg()