Creates a Canari transform package skeleton.
188308
def create_package(package, author, email, description, create_example):
    """"""
    from canari.commands.create_package import create_package
    create_package(package, author, email, description, create_example)
775772
private static function createDependencies()
    {
        if (isset(self::$renderers)) {
            return;
        }

        self::$renderers = array(
            'rect'      => new Renderers\SVGRectRenderer(),
            'line'      => new Renderers\SVGLineRenderer(),
            'ellipse'   => new Renderers\SVGEllipseRenderer(),
            'polygon'   => new Renderers\SVGPolygonRenderer(),
            'image'     => new Renderers\SVGImageRenderer(),
            'text'      => new Renderers\SVGTextRenderer(),
        );

        self::$pathParser       = new Path\SVGPathParser();
        self::$pathApproximator = new Path\SVGPathApproximator();
    }
528385
public function add_commands() {
		/**
		 * Search for other Skeleton packages installed
		 */
		$skeletons = \Skeleton\Core\Skeleton::get_all();

		/**
		 * Check in every Skeleton package for commands
		 */
		foreach ($skeletons as $skeleton) {

			if (!file_exists($skeleton->path . '/console')) {
				continue;
			}

			$files = scandir($skeleton->path . '/console');

			foreach ($files as $file) {
				if ($file[0] == '.') {
					continue;
				}
				require_once $skeleton->path . '/console/' . $file;

				$file = str_replace('.php', '', $file);

				$classname = '\Skeleton\Console\Command\\' . ucfirst(str_replace('-', '_', str_replace('skeleton-', '', $skeleton->name))) . '_' . ucfirst($file);
				$this->add(new $classname);
			}
		}
	}
1015409
public void processPacket(OggPacket packet) {
        SkeletonPacket skel = SkeletonPacketFactory.create(packet);

        // First packet must be the head
        if (packet.isBeginningOfStream()) {
            fishead = (SkeletonFishead)skel;
        } else if (skel instanceof SkeletonFisbone) {
            SkeletonFisbone bone = (SkeletonFisbone)skel;
            fisbones.add(bone);
            bonesByStream.put(bone.getSerialNumber(), bone);
        } else if (skel instanceof SkeletonKeyFramePacket) {
            keyFrames.add((SkeletonKeyFramePacket)skel);
        } else {
            throw new IllegalStateException("Unexpected Skeleton " + skel);
        }

        if (packet.isEndOfStream()) {
            hasWholeStream = true;
        }
    }
700761
public function wrap(AMQPEnvelope $envelope, $properties_skeleton = 'AMQPy\Client\Properties', $envelope_skeleton = 'AMQPy\Client\Envelope')
    {
        return new $this->wrapper_skeleton($envelope, $properties_skeleton, $envelope_skeleton);
    }
459501
def __generate_tree(self, top, src, resources, models, ctrls, views, utils):
        """"""
        res = self.__mkdir(top)
        for fn in (src, models, ctrls, views, utils): res = self.__mkpkg(fn) or res
        res = self.__mkdir(resources) or res
        res = self.__mkdir(os.path.join(resources, "ui", "builder")) or res
        res = self.__mkdir(os.path.join(resources, "ui", "styles")) or res
        res = self.__mkdir(os.path.join(resources, "external")) or res
        return res
701053
private function translate_skeleton_package(\Skeleton\Core\Skeleton $package) {
		$log = '';
		$log .= 'translating ' . $package->name . ' (' . $package->template_path . ')' . "\n";

		// Fetch the templates in this directory
		if (!file_exists($package->template_path)) {
			return;
		}
		$templates = $this->get_templates($package->template_path);
		$strings = [];

		// Parse all the files we found
		foreach ($templates as $template) {
			$strings = array_merge($strings, $this->get_strings($template, $package->template_path));
		}

		// Translate the strings
		$language_interface = \Skeleton\I18n\Config::$language_interface;
		if (!class_exists($language_interface)) {
			throw new \Exception('The language interface does not exists: ' . $language_interface);
		}

		$languages = $language_interface::get_all();

		foreach ($languages as $language) {
			// Don't create a .po file if it is our base_language
			if ($language->name_short == \Skeleton\I18n\Config::$base_language) {
				continue;
			}

			$log .=  ' ' . $language->name_short;

			// If we have a translation in the package, load it
			$package_translated = [];
			if (file_exists($package->path . '/po/' . $language->name_short . '.po')) {
				$package_translated = \Skeleton\I18n\Util::load($package->path . '/po/' . $language->name_short . '.po');
			}

			// If there is a local translation file, load it
			$local_translated = [];
			if (file_exists(\Skeleton\I18n\Config::$po_directory . '/' . $language->name_short . '/package/' . $package->name . '.po')) {
				$local_translated = \Skeleton\I18n\Util::load(\Skeleton\I18n\Config::$po_directory . '/' . $language->name_short . '/package/' . $package->name . '.po');
			}

			// Create a new array with the merged translations
			$new_po = [];
			foreach ($strings as $string) {
				if (isset($local_translated[$string]) and $local_translated[$string] != '') {
					$new_po[$string] = $local_translated[$string];
				} elseif (isset($package_translated[$string]) and $package_translated[$string] != '') {
					$new_po[$string] = $package_translated[$string];
				} else {
					$new_po[$string] = '';
				}
			}

			$result1 = array_diff_key($new_po, $local_translated);
			$result2 = array_diff_key($local_translated, $new_po);
			if (count($result1) == 0 and count($result2) == 0) {
				// No new po file will be created, there are no changes
				continue;
			}

			// Stop doing what we are doing if there are no strings anyway
			if (count($new_po) == 0) {
				continue;
			}

			// And save!
			\Skeleton\I18n\Util::save(\Skeleton\I18n\Config::$po_directory . '/' . $language->name_short . '/package/' . $package->name . '.po', $package->name, $language, $new_po);
		}

		$log .= "\n";
		return $log;
	}
1320605
def create_package_file(root, master_package, subroot, py_files, opts, subs):
    """"""
    text = format_heading(1, '%s' % makename(master_package, subroot))

    if opts.modulefirst:
        text += format_directive(subroot, master_package)
        text += '\n'

    # build a list of directories that are szvpackages (contain an INITPY file)
    subs = [sub for sub in subs if path.isfile(path.join(root, sub, INITPY))]
    # if there are some package directories, add a TOC for theses subpackages
    if subs:
        # text += format_heading(2, 'Subpackages')
        text += '.. toctree::\n\n'
        for sub in subs:
            text += '    %s.%s\n' % (makename(master_package, subroot), sub)
        text += '\n'

    submods = [path.splitext(sub)[0] for sub in py_files
               if not shall_skip(path.join(root, sub), opts) and
               sub != INITPY]
    if submods:
        #text += format_heading(2, 'Submodules')
        if opts.separatemodules:
            text += '.. toctree::\n\n'
            for submod in submods:
                modfile = makename(master_package, makename(subroot, submod))
                text += '   %s\n' % modfile

                # generate separate file for this module
                if not opts.noheadings:
                    filetext = format_heading(1, '%s module' % modfile)
                else:
                    filetext = ''
                filetext += format_directive(makename(subroot, submod),
                                             master_package)
                write_file(modfile, filetext, opts)
        else:
            for submod in submods:
                modfile = makename(master_package, makename(subroot, submod))
                if not opts.noheadings:
                    text += format_heading(2, '%s module' % modfile)
                text += format_directive(makename(subroot, submod),
                                         master_package)
                text += '\n'
        text += '\n'

    if not opts.modulefirst:
        text += format_heading(2, 'Module contents')
        text += format_directive(subroot, master_package)

    write_file(makename(master_package, subroot), text, opts)
630277
def create_skeleton(shutit):
	
	skel_path        = shutit.cfg['skeleton']['path']
	skel_module_name = shutit.cfg['skeleton']['module_name']
	skel_domain      = shutit.cfg['skeleton']['domain']
	skel_domain_hash = shutit.cfg['skeleton']['domain_hash']
	skel_depends     = shutit.cfg['skeleton']['depends']
	skel_shutitfiles = shutit.cfg['skeleton']['shutitfiles']
	skel_delivery    = shutit.cfg['skeleton']['delivery']
	skel_pattern     = shutit.cfg['skeleton']['pattern']
	# For vagrant only
	skel_vagrant_num_machines   = shutit.cfg['skeleton']['vagrant_num_machines']
	skel_vagrant_machine_prefix = shutit.cfg['skeleton']['vagrant_machine_prefix']
	skel_vagrant_ssh_access     = shutit.cfg['skeleton']['vagrant_ssh_access']
	skel_vagrant_docker         = shutit.cfg['skeleton']['vagrant_docker']
	skel_vagrant_snapshot       = shutit.cfg['skeleton']['vagrant_snapshot']
	skel_vagrant_upload         = shutit.cfg['skeleton']['vagrant_upload']
	skel_vagrant_image_name     = shutit.cfg['skeleton']['vagrant_image_name']

	# Check setup
	if not skel_path or skel_path[0] != '/':
		shutit.fail('Must supply a directory and it must be absolute') # pragma: no cover
	if os.path.exists(skel_path):
		shutit.fail(skel_path + ' already exists') # pragma: no cover
	if not skel_module_name:
		shutit.fail('Must supply a name for your module, eg mymodulename') # pragma: no cover
	if not re.match('^[a-zA-z_][0-9a-zA-Z_]+$', skel_module_name):
		shutit.fail('Module names must comply with python classname standards: cf: http://stackoverflow.com/questions/10120295/valid-characters-in-a-python-class-name name: ' + skel_module_name) # pragma: no cover
	if not skel_domain:
		shutit.fail('Must supply a domain for your module, eg com.yourname.madeupdomainsuffix') # pragma: no cover

	# Create folders and process pattern
	os.makedirs(skel_path)
	os.chdir(skel_path)
	# If it's shutitfile and vagrant
	if shutit.cfg['skeleton']['pattern'] == 'bash':
		from shutit_patterns import bash
		bash.setup_bash_pattern(shutit,
		                        skel_path=skel_path,
		                        skel_delivery=skel_delivery,
		                        skel_domain=skel_domain,
		                        skel_module_name=skel_module_name,
		                        skel_shutitfiles=skel_shutitfiles,
		                        skel_domain_hash=skel_domain_hash,
		                        skel_depends=skel_depends)
	elif shutit.cfg['skeleton']['pattern'] == 'docker':
		from shutit_patterns import docker
		docker.setup_docker_pattern(shutit,
		                            skel_path=skel_path,
		                            skel_delivery=skel_delivery,
		                            skel_domain=skel_domain,
		                            skel_module_name=skel_module_name,
		                            skel_shutitfiles=skel_shutitfiles,
		                            skel_domain_hash=skel_domain_hash,
		                            skel_depends=skel_depends)
	elif shutit.cfg['skeleton']['pattern'] == 'vagrant': # pragma: no cover
		from shutit_patterns import vagrant
		vagrant.setup_vagrant_pattern(shutit,
		                              skel_path=skel_path,
		                              skel_delivery=skel_delivery,
		                              skel_domain=skel_domain,
		                              skel_module_name=skel_module_name,
		                              skel_shutitfiles=skel_shutitfiles,
		                              skel_domain_hash=skel_domain_hash,
		                              skel_depends=skel_depends,
		                              skel_vagrant_num_machines=skel_vagrant_num_machines,
		                              skel_vagrant_machine_prefix=skel_vagrant_machine_prefix,
		                              skel_vagrant_ssh_access=skel_vagrant_ssh_access,
		                              skel_vagrant_docker=skel_vagrant_docker,
		                              skel_vagrant_snapshot=skel_vagrant_snapshot,
		                              skel_vagrant_upload=skel_vagrant_upload,
		                              skel_vagrant_image_name=skel_vagrant_image_name)
	elif shutit.cfg['skeleton']['pattern'] == 'shutitfile':
		shutitfile.setup_shutitfile_pattern(shutit,
		                                    skel_path=skel_path,
		                                    skel_delivery=skel_delivery,
		                                    skel_pattern=skel_pattern,
		                                    skel_domain=skel_domain,
		                                    skel_module_name=skel_module_name,
		                                    skel_vagrant_num_machines=skel_vagrant_num_machines,
		                                    skel_vagrant_machine_prefix=skel_vagrant_machine_prefix,
		                                    skel_vagrant_ssh_access=skel_vagrant_ssh_access,
		                                    skel_vagrant_docker=skel_vagrant_docker)
	elif shutit.cfg['skeleton']['pattern'] == 'docker_tutorial': # pragma: no cover
		shutit.fail('docker_tutorial not yet supported')
691388
private MethodSpec.Builder buildSkeletonType(Set<String> dateSkeletons, Set<String> timeSkeletons) {
    MethodSpec.Builder method = MethodSpec.methodBuilder("skeletonType")
        .addJavadoc("Indicates whether a given skeleton pattern is a DATE or TIME.\n")
        .addModifiers(PUBLIC, STATIC)
        .addParameter(String.class, "skeleton")
        .returns(SKELETON);

    method.beginControlFlow("switch (skeleton)");
    
    for (String skel : dateSkeletons) {
      method.addCode("case $S:\n", skel);
    }
    method.addStatement("  return $T.DATE", SKELETON);
    
    for (String skel : timeSkeletons) {
      method.addCode("case $S:\n", skel);
    }
    method.addStatement("  return $T.TIME", SKELETON);

    method.addCode("default:\n");
    method.addStatement("  return null");
    method.endControlFlow();

    return method;
  }
142770
def generate(ast_tree: ast.Tree, model_name: str):
    
    component_ref = ast.ComponentRef.from_string(model_name)
    ast_tree_new = copy.deepcopy(ast_tree)
    ast_walker = TreeWalker()
    flat_tree = flatten(ast_tree_new, component_ref)
    sympy_gen = SympyGenerator()
    ast_walker.walk(sympy_gen, flat_tree)
    return sympy_gen.src[flat_tree]
1328198
def make_model(self):
        """"""
        for stmt in self.statements:
            if isinstance(stmt, Modification):
                card = assemble_modification(stmt)
            elif isinstance(stmt, SelfModification):
                card = assemble_selfmodification(stmt)
            elif isinstance(stmt, Complex):
                card = assemble_complex(stmt)
            elif isinstance(stmt, Translocation):
                card = assemble_translocation(stmt)
            elif isinstance(stmt, RegulateActivity):
                card = assemble_regulate_activity(stmt)
            elif isinstance(stmt, RegulateAmount):
                card = assemble_regulate_amount(stmt)
            else:
                continue
            if card is not None:
                card.card['meta'] = {'id': stmt.uuid, 'belief': stmt.belief}
                if self.pmc_override is not None:
                    card.card['pmc_id'] = self.pmc_override
                else:
                    card.card['pmc_id'] = get_pmc_id(stmt)
                self.cards.append(card)
1127169
def _node_to_model(tree_or_item, package, parent=None,
                   lucent_id=TRANSLUCENT_BINDER_ID):
    """"""
    if 'contents' in tree_or_item:
        # It is a binder.
        tree = tree_or_item
        # Grab the package metadata, so we have required license info
        metadata = package.metadata.copy()
        if tree['id'] == lucent_id:
            metadata['title'] = tree['title']
            binder = TranslucentBinder(metadata=metadata)
        else:
            try:
                package_item = package.grab_by_name(tree['id'])
                binder = BinderItem(package_item, package)
            except KeyError:  # Translucent w/ id
                metadata.update({
                   'title': tree['title'],
                   'cnx-archive-uri': tree['id'],
                   'cnx-archive-shortid': tree['shortId']})
                binder = Binder(tree['id'], metadata=metadata)
        for item in tree['contents']:
            node = _node_to_model(item, package, parent=binder,
                                  lucent_id=lucent_id)
            if node.metadata['title'] != item['title']:
                binder.set_title_for_node(node, item['title'])
        result = binder
    else:
        # It is a document.
        item = tree_or_item
        package_item = package.grab_by_name(item['id'])
        result = adapt_item(package_item, package)
    if parent is not None:
        parent.append(result)
    return result
837674
def make(base_classes=(), have_mt=False):
        """"""

        good_bc = ModelFactory.__fix_bases(base_classes, have_mt)
        print "Base classes are:", good_bc
        key = "".join(map(str, good_bc))
        if key in ModelFactory.__memoized:
            return ModelFactory.__memoized[key]

        cls = new.classobj('', good_bc, {'__module__': '__main__', '__doc__': None})
        ModelFactory.__memoized[key] = cls
        return cls
94130
def create_skel(role):
    '''
    
    '''

    role = role.lower()
    if not role in _skeletons:
        raise RuntimeError("Role {} not found. Should be 'component', 'element', 'table', or 'metadata'")

    return copy.deepcopy(_skeletons[role])
285600
def create_package(ctx, opts, owner, repo, package_type, skip_errors, **kwargs):
    """"""
    click.echo(
        "Creating a new %(package_type)s package ... "
        % {"package_type": click.style(package_type, bold=True)},
        nl=False,
    )

    context_msg = "Failed to create package!"
    with handle_api_exceptions(
        ctx, opts=opts, context_msg=context_msg, reraise_on_error=skip_errors
    ):
        with maybe_spinner(opts):
            slug_perm, slug = api_create_package(
                package_format=package_type, owner=owner, repo=repo, **kwargs
            )

    click.secho("OK", fg="green")

    click.echo(
        "Created: %(owner)s/%(repo)s/%(slug)s (%(slug_perm)s)"
        % {
            "owner": click.style(owner, fg="magenta"),
            "repo": click.style(repo, fg="magenta"),
            "slug": click.style(slug, fg="green"),
            "slug_perm": click.style(slug_perm, bold=True),
        }
    )

    return slug_perm, slug
612290
private void createShape() {
    if (shape == null) {
      float firstItemMargin = noxConfig.getNoxItemMargin();
      float firstItemSize = noxConfig.getNoxItemSize();
      int viewHeight = getMeasuredHeight();
      int viewWidth = getMeasuredWidth();
      int numberOfElements = noxItemCatalog.size();
      ShapeConfig shapeConfig =
          new ShapeConfig(numberOfElements, viewWidth, viewHeight, firstItemSize, firstItemMargin);
      shape = ShapeFactory.getShapeByKey(defaultShapeKey, shapeConfig);
    } else {
      shape.setNumberOfElements(noxItemCatalog.size());
    }
    shape.calculate();
  }