Create a toolkit project with the given name and options.
170963
async function create(name, options, api, env) {
  // Grab the cwd and npmClient off of the environment. We can use these to
  // create the folder for the project and for determining what client to use
  // for npm-related commands
  const { CLI_ENV, cwd, npmClient } = env;
  // We support a couple of options for our `create` command, some only exist
  // during development (like link and linkCli).
  const { link, linkCli, plugins = [], presets = [], skip } = options;
  const root = path.join(cwd, name);

  logger.trace('Creating project:', name, 'at:', root);

  if (await fs.exists(root)) {
    throw new Error(`A folder already exists at \`${root}\``);
  }

  // Create the root directory for the new project
  await fs.ensureDir(root);

  const {
    writePackageJson,
    installDependencies,
    linkDependencies,
  } = await createClient(npmClient, root);
  const packageJson = {
    name,
    private: true,
    license: 'MIT',
    scripts: {},
    dependencies: {},
    devDependencies: {},
    toolkit: {},
  };

  // Write the packageJson to the newly created `root` folder
  await writePackageJson(packageJson);

  const installer = linkCli ? linkDependencies : installDependencies;
  await installer(['@carbon/toolkit']);

  if (CLI_ENV === 'production') {
    clearConsole();
  }

  if (skip) {
    displaySuccess(root, name, npmClient);
    return;
  }

  const toolkit = await which('toolkit', { cwd: root });

  if (presets.length > 0) {
    const args = ['add', ...presets, link && '--link'].filter(Boolean);
    await spawn(toolkit, args, {
      cwd: root,
      stdio: 'inherit',
    });
  }

  if (plugins.length > 0) {
    const args = ['add', ...plugins, link && '--link'].filter(Boolean);
    await spawn(toolkit, args, {
      cwd: root,
      stdio: 'inherit',
    });
  }

  displaySuccess(root, name, npmClient);
}
843961
def create_set(self, project, json_data=None, **options):
        
        url = URL.articlesets.format(**locals())
        if json_data is None:
            # form encoded request
            return self.request(url, method="post", data=options)
        else:
            if not isinstance(json_data, (string_types)):
                json_data = json.dumps(json_data,default = serialize)
            headers = {'content-type': 'application/json'}
            return self.request(
                url, method='post', data=json_data, headers=headers)
128746
def create_project(project_name, template="default"):
    

    project_dir = get_project_dir_path(project_name)

    run_tpl = pkg_resources.resource_string(__name__, '%s/run.py' % (SKELETON_DIR))
    init_py_tpl = pkg_resources.resource_string(__name__, '%s/init.py' % (SKELETON_DIR))
    deployapp_tpl = pkg_resources.resource_string(__name__, '%s/deployapp.yml' % (SKELETON_DIR))
    config_tpl = pkg_resources.resource_string(__name__, '%s/config.py' % (SKELETON_DIR))
    model_tpl = pkg_resources.resource_string(__name__, '%s/model.py' % (SKELETON_DIR))
    manage_tpl = pkg_resources.resource_string(__name__, '%s/manage.py' % (SKELETON_DIR))

    run_file = "%s/run_%s.py" % (CWD, project_name)
    requirements_txt = "%s/requirements.txt" % CWD
    deployapp_yml = "%s/deployapp.yml" % CWD
    config_py = "%s/config.py" % APPLICATION_DIR
    model_py = "%s/model.py" % APPLICATION_DIR
    manage_py = "%s/manage.py" % CWD

    if not os.path.isdir(APPLICATION_DIR):
        os.makedirs(APPLICATION_DIR)

    if not os.path.isdir(project_dir):
        os.makedirs(project_dir)

    _app_init_py = "%s/__init__.py" % APPLICATION_DIR
    if not os.path.isfile(_app_init_py):
        with open(_app_init_py, "wb") as f:
            f.write(init_py_tpl)

    _init_py = "%s/__init__.py" % CWD
    if not os.path.isfile(_init_py):
        with open(_init_py, "wb") as f:
            f.write("# Pylot")

    if not os.path.isfile(config_py):
        with open(config_py, "wb") as f:
            f.write(config_tpl)

    if not os.path.isfile(model_py):
        with open(model_py, "wb") as f:
            f.write(model_tpl)

    if not os.path.isfile(run_file):
        with open(run_file, "wb") as f:
            f.write(run_tpl.format(project_name=project_name))

    if not os.path.isfile(requirements_txt):
        with open(requirements_txt, "wb") as f:
            f.write("%s==%s" % (PACKAGE.NAME, PACKAGE.__version__))

    if not os.path.isfile(deployapp_yml):
        with open(deployapp_yml, "wb") as f:
            f.write(deployapp_tpl)

    if not os.path.isfile(manage_py):
        with open(manage_py, "wb") as f:
            f.write(manage_tpl)

    copy_resource("%s/%s/" % (SKELETON_DIR, template), project_dir)
448718
def create_generate(kind, project, resource, offset):
    
    generate = eval('Generate' + kind.title())
    return generate(project, resource, offset)
453232
def init(self, project_name='', template='base', quiet=False, debug=False):
        ''''''

        self.logger.setLevel(DEBUG if debug else WARNING)

        self.logger.info('Project creation started.')

        self.logger.debug(f'Template: {template}')

        template_path = Path(template)

        if not template_path.exists():
            self.logger.debug(
                f'Template not found in {template_path}, looking in installed templates.'
            )

            installed_templates_path = Path(Path(__file__).parent / 'templates')

            installed_templates = [
                item.name for item in installed_templates_path.iterdir() if item.is_dir()
            ]

            self.logger.debug(f'Available templates: {installed_templates}')

            if template in installed_templates:
                self.logger.debug('Template found.')

            else:
                self.logger.debug('Template not found, asking for user input.')

                try:
                    template = prompt(
                        f'Please pick a template from {installed_templates}: ',
                        completer=WordCompleter(installed_templates),
                        validator=BuiltinTemplateValidator(installed_templates)
                    )

                except KeyboardInterrupt:
                    self.logger.warning('Project creation interrupted.')
                    return

            template_path = installed_templates_path / template

            self.logger.debug(f'Template path: {template_path}')

        if not project_name:
            self.logger.debug('Project name not specified, asking for user input.')

            try:
                project_name = prompt('Enter the project name: ')

            except KeyboardInterrupt:
                self.logger.warning('Project creation interrupted.')
                return

        project_slug = slugify(project_name)
        project_path = Path(project_slug)

        properties = {
            'title': project_name,
            'slug': project_slug
        }

        self.logger.debug(f'Project properties: {properties}')

        result = None

        with spinner('Generating project', self.logger, quiet, debug):
            copytree(template_path, project_path)

            text_types = '*.md', '*.yml', '*.txt', '*.py'

            text_file_paths = reduce(
                lambda acc, matches: acc + [*matches],
                (project_path.rglob(text_type) for text_type in text_types),
                []
            )

            for text_file_path in text_file_paths:
                self.logger.debug(f'Processing content of {text_file_path}')
                replace_placeholders(text_file_path, properties)

            for item in project_path.rglob('*'):
                self.logger.debug(f'Processing name of {item}')
                item.rename(Template(item.as_posix()).safe_substitute(properties))

            result = project_path

        if result:
            self.logger.info(f'Result: {result}')

            if not quiet:
                print('─' * 20)
                print(f'Project "{project_name}" created in {result}')
            else:
                print(result)

        else:
            self.logger.critical('Project creation failed.')
            exit(1)
1123086
def generate(env):
    """"""
    for t in SCons.Tool.tool_list(env['PLATFORM'], env):
        SCons.Tool.Tool(t)(env)
29462
def use(name):
    
    global toolkit, family

    name = name.lower()

    if name.startswith('choose'):
        pass

    elif name.startswith('qt') or name.startswith('pyside'):
        family = 'qt'
        if name == 'qt':
            name = 'qt4'
        assert name in ('qt4', 'pyside', 'qt5'), \
            ToolKitError("ToolKit '%s' not supported!" % (name))

    elif name.startswith('gtk'):
        # default for "gtk" is gtk3
        if name in ('gtk', 'gtk3'):
            name = 'gtk3'
            family = 'gtk3'
        elif name in ('gtk2',):
            family = 'gtk'
        assert name in ('gtk2', 'gtk3'), \
            ToolKitError("ToolKit '%s' not supported!" % (name))

    elif name.startswith('tk'):
        family = 'tk'
        assert name in ('tk', ), \
            ToolKitError("ToolKit '%s' not supported!" % (name))

    elif name.startswith('pg'):
        family = 'pg'
        assert name in ('pg', ), \
            ToolKitError("ToolKit '%s' not supported!" % (name))

    else:
        ToolKitError("ToolKit '%s' not supported!" % (name))

    toolkit = name
163083
def build_module(project, env=None):
        ''''''
        from pyspider.libs import base_handler
        assert 'name' in project, 'need name of project'
        assert 'script' in project, 'need script of project'

        if env is None:
            env = {}
        # fix for old non-package version scripts
        pyspider_path = os.path.join(os.path.dirname(__file__), "..")
        if pyspider_path not in sys.path:
            sys.path.insert(1, pyspider_path)

        env = dict(env)
        env.update({
            'debug': project.get('status', 'DEBUG') == 'DEBUG',
        })

        loader = ProjectLoader(project)
        module = loader.load_module(project['name'])

        # logger inject
        module.log_buffer = []
        module.logging = module.logger = logging.Logger(project['name'])
        if env.get('enable_stdout_capture', True):
            handler = SaveLogHandler(module.log_buffer)
            handler.setFormatter(LogFormatter(color=False))
        else:
            handler = logging.StreamHandler()
            handler.setFormatter(LogFormatter(color=True))
        module.logger.addHandler(handler)

        if '__handler_cls__' not in module.__dict__:
            BaseHandler = module.__dict__.get('BaseHandler', base_handler.BaseHandler)
            for each in list(six.itervalues(module.__dict__)):
                if inspect.isclass(each) and each is not BaseHandler \
                        and issubclass(each, BaseHandler):
                    module.__dict__['__handler_cls__'] = each
        _class = module.__dict__.get('__handler_cls__')
        assert _class is not None, "need BaseHandler in project module"

        instance = _class()
        instance.__env__ = env
        instance.project_name = project['name']
        instance.project = project

        return {
            'loader': loader,
            'module': module,
            'class': _class,
            'instance': instance,
            'exception': None,
            'exception_log': '',
            'info': project,
            'load_time': time.time(),
        }
883051
def init(project_name):
    
    # the destination path
    dst_path = os.path.join(os.getcwd(), project_name)

    start_init_info(dst_path)

    # create dst path
    _mkdir_p(dst_path)

    os.chdir(dst_path)
    # create files
    init_code('manage.py', _manage_basic_code)
    init_code('requirement.txt', _requirement_code)

    # create app/
    app_path = os.path.join(dst_path, 'app')
    _mkdir_p(app_path)

    os.chdir(app_path)
    # create files
    init_code('views.py', _views_basic_code)
    init_code('forms.py', _forms_basic_code)
    init_code('__init__.py', _init_basic_code)

    create_templates_static_files(app_path)

    init_done_info()
1024396
def create_prj(self, ):
        
        name = self.name_le.text()
        short = self.short_le.text()
        path = self.path_le.text()
        semester = self.semester_le.text()
        try:
            prj = djadapter.models.Project(name=name, short=short, path=path, semester=semester)
            prj.save()
            self.project = prj
            self.accept()
        except:
            log.exception("Could not create new project")
387617
def create(project, credentials): #pylint: disable=too-many-return-statements
        """"""

        if not settings.COMMAND:
            return flask.make_response("Projects disabled, no command configured",404)

        user, oauth_access_token = parsecredentials(credentials) #pylint: disable=unused-variable
        if not Project.validate(project):
            return withheaders(flask.make_response('Invalid project ID. Note that only alphanumerical characters are allowed.',403),headers={'allow_origin': settings.ALLOW_ORIGIN})
        printdebug("Checking if " + settings.ROOT + "projects/" + user + '/' + project + " exists")
        if not project:
            return withheaders(flask.make_response('No project name',403),headers={'allow_origin': settings.ALLOW_ORIGIN})
        if not os.path.isdir(settings.ROOT + "projects/" + user):
            printlog("Creating user directory '" + user + "'")
            os.makedirs(settings.ROOT + "projects/" + user)
            if not os.path.isdir(settings.ROOT + "projects/" + user): #verify:
                return withheaders(flask.make_response("Directory " + settings.ROOT + "projects/" + user + " could not be created succesfully",403),headers={'allow_origin': settings.ALLOW_ORIGIN})


        #checking user quota
        if settings.USERQUOTA > 0:
            _, totalsize = getprojects(user)
            if totalsize > settings.USERQUOTA:
                printlog("User " + user + " exceeded quota, refusing to create new project...")
                return withheaders(flask.make_response("Unable to create new project because you are exceeding your disk quota (max " + str(settings.USERQUOTA) + " MB, you now use " + str(totalsize) + " MB). Please delete some projects and try again.",403),headers={'allow_origin': settings.ALLOW_ORIGIN})

        if not os.path.isdir(settings.ROOT + "projects/" + user + '/' + project):
            printlog("Creating project '" + project + "'")
            os.makedirs(settings.ROOT + "projects/" + user + '/' + project)

        #project index will need to be regenerated, remove cache
        if os.path.exists(os.path.join(settings.ROOT + "projects/" + user,'.index')):
            os.unlink(os.path.join(settings.ROOT + "projects/" + user,'.index'))

        if not os.path.isdir(settings.ROOT + "projects/" + user + '/' + project + '/input/'):
            os.makedirs(settings.ROOT + "projects/" + user + '/' + project + "/input")
            if not os.path.isdir(settings.ROOT + "projects/" + user + '/' + project + '/input'):
                return withheaders(flask.make_response("Input directory " + settings.ROOT + "projects/" + user + '/' + project + "/input/  could not be created succesfully",403),headers={'allow_origin': settings.ALLOW_ORIGIN})
        if not os.path.isdir(settings.ROOT + "projects/" + user + '/' + project + '/output/'):
            os.makedirs(settings.ROOT + "projects/" + user + '/' + project + "/output")
            if not os.path.isdir(settings.ROOT + "projects/" + user + '/' + project + '/output'):
                return withheaders(flask.make_response("Output directory " + settings.ROOT + "projects/" + user + '/' + project + "/output/  could not be created succesfully",403),headers={'allow_origin': settings.ALLOW_ORIGIN})
        if not os.path.isdir(settings.ROOT + "projects/" + user + '/' + project + '/tmp/'):
            os.makedirs(settings.ROOT + "projects/" + user + '/' + project + "/tmp")
            if not os.path.isdir(settings.ROOT + "projects/" + user + '/' + project + '/tmp'):
                return withheaders(flask.make_response("tmp directory " + settings.ROOT + "projects/" + user + '/' + project + "/tmp/  could not be created succesfully",403),headers={'allow_origin': settings.ALLOW_ORIGIN})

        return None
361860
public AzkabanClientStatus createProject(String projectName,
                                           String description) throws AzkabanClientException {
    AzkabanMultiCallables.CreateProjectCallable callable =
       AzkabanMultiCallables.CreateProjectCallable.builder()
           .client(this)
           .projectName(projectName)
           .description(description)
           .build();

    return runWithRetry(callable, AzkabanClientStatus.class);
  }
493264
def create(self, project_name, template_name, substitutions):
        
        self.project_name = project_name
        self.template_name = template_name

        # create substitutions dictionary from user arguments
        # TODO: check what is given
        for subs in substitutions:
            current_sub = subs.split(',')
            current_key = current_sub[0].strip()
            current_val = current_sub[1].strip()
            self.substitutes_dict[current_key] = current_val

        self.term.print_info(u"Creating project '{0}' with template {1}"
            .format(self.term.text_in_color(project_name, TERM_PINK), template_name))

        self.make_directories()
        self.make_files()
        self.make_posthook()
83803
def create_project(name, include_examples=True):
        '''
        
        '''

        # from the start directory, create a project directory with the project name
        path = "{}/{}".format(os.getcwd(), name)
        if os.path.exists(path):
            return None, "path {} already exists".format(path)

        print(bright("creating new ezo project '{}".format(name)))

        # make project directory
        os.mkdir(path)
        print(bright("created project directory: '{}".format(path)))

        # create an empty contracts directory
        contracts_dir = "{}/{}".format(path, "contracts")
        os.mkdir(contracts_dir)
        print(bright("created contract directory: '{}".format(contracts_dir)))

        if include_examples:
            c = [(create_sample_contracts_1(), 'contract1.sol'), (create_sample_contracts_2(), 'contract2.sol')]
            for s in c:
                c, fn = s
                file_path = "{}/{}".format(contracts_dir, fn)
                try:
                    with open(file_path, "w+") as outfile:
                        outfile.write(c)
                except Exception as e:
                    print(bright("problem creating sample file: '{}".format(path)))
                    return None, e
                print(bright("created sample contract: '{}".format(fn)))

        # create the handlers directory
        handlers_dir = "{}/{}".format(path, "handlers")
        os.mkdir(handlers_dir)
        print(bright("created handlers directory: '{}".format(handlers_dir)))

        # leveldb directory (created by level)
        leveldb = "{}/{}".format(path, "ezodb")

        # create the initial config.json file
        cfg = create_blank_config_obj()

        cfg["ezo"]["contract-dir"] = contracts_dir
        cfg["ezo"]["handlers-dir"] = handlers_dir
        cfg["ezo"]["project-name"] = name
        cfg["ezo"]["leveldb"] = leveldb
        print(bright("creating configuration: '{}".format(path)))

        # write the file to the root project dir
        config_file_path = "{}/{}".format(path, "ezo.conf")
        try:
            with open(config_file_path, "w+") as outfile:
                json.dump(cfg, outfile, indent=2)
        except Exception as e:
            print(bright("problem creating configuration file: '{}".format(path)))
            return None, e

        return None, None
1580
def create_scaffold(project_name):
    
    if os.path.isdir(project_name):
        logger.log_warning(u"Folder {} exists, please specify a new folder name.".format(project_name))
        return

    logger.color_print("Start to create new project: {}".format(project_name), "GREEN")
    logger.color_print("CWD: {}\n".format(os.getcwd()), "BLUE")

    def create_path(path, ptype):
        if ptype == "folder":
            os.makedirs(path)
        elif ptype == "file":
            open(path, 'w').close()

        msg = "created {}: {}".format(ptype, path)
        logger.color_print(msg, "BLUE")

    path_list = [
        (project_name, "folder"),
        (os.path.join(project_name, "api"), "folder"),
        (os.path.join(project_name, "testcases"), "folder"),
        (os.path.join(project_name, "testsuites"), "folder"),
        (os.path.join(project_name, "reports"), "folder"),
        (os.path.join(project_name, "debugtalk.py"), "file"),
        (os.path.join(project_name, ".env"), "file")
    ]
    [create_path(p[0], p[1]) for p in path_list]

    # create .gitignore file
    ignore_file = os.path.join(project_name, ".gitignore")
    ignore_content = ".env\nreports/*"
    with open(ignore_file, "w") as f:
        f.write(ignore_content)
691563
def create_project(self, name, body=github.GithubObject.NotSet):
        
        assert isinstance(name, (str, unicode)), name
        assert body is github.GithubObject.NotSet or isinstance(body, (str, unicode)), body
        post_parameters = {
            "name": name,
            "body": body,
        }
        import_header = {"Accept": Consts.mediaTypeProjectsPreview}
        if body is not github.GithubObject.NotSet:
            post_parameters['body'] = body
        headers, data = self._requester.requestJsonAndCheck(
            "POST",
            self.url + "/projects",
            headers=import_header,
            input=post_parameters
        )
        return github.Project.Project(self._requester, headers, data, completed=True)
1310213
def _make_cmake(config_info):
    """"""
    configure_args = ["-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"]
    cmake_args = {}

    options, option_fns = _make_all_options()

    def _add_value(value, key):
        args_key, args_value = _EX_ARG_FNS[key](value)
        cmake_args[args_key] = args_value

    devpipeline_core.toolsupport.args_builder(
        "cmake",
        config_info,
        options,
        lambda v, key: configure_args.extend(option_fns[key](v)),
    )
    devpipeline_core.toolsupport.args_builder(
        "cmake", config_info, _EX_ARGS, _add_value
    )
    cmake = CMake(cmake_args, config_info, configure_args)
    build_type = config_info.config.get("cmake.build_type")
    if build_type:
        cmake.set_build_type(build_type)
    return devpipeline_build.make_simple_builder(cmake, config_info)