Builder for container attributes.
487354
def _container_attrib_builder(name, container, mapper):
    """"""
    context = {'@container': '@{0}'.format(name)}

    def _attrib(type, **kwargs):
        """Define a container attribute."""
        kwargs.setdefault('metadata', {})
        kwargs['metadata'][KEY_CLS] = type
        kwargs['default'] = Factory(container)

        def _converter(value):
            """Convert value to the given type."""
            if isinstance(value, container):
                return mapper(type, value)
            elif value is None:
                return value
            raise ValueError(value)

        kwargs.setdefault('converter', _converter)
        context_ib = context.copy()
        context_ib.update(kwargs.pop('context', {}))
        return attrib(context=context_ib, **kwargs)

    return _attrib
1252491
public function build(ContainerBuilder $container)
    {
        $container->addCompilerPass(
            new GenericCompilerPass(
                AttributeTypeRegistry::class,
                'sidus.attribute_type',
                'addType'
            )
        );
        $container->addCompilerPass(
            new GenericCompilerPass(
                AttributeRegistry::class,
                'sidus.attribute',
                'addAttribute'
            )
        );
        $container->addCompilerPass(
            new GenericCompilerPass(
                FamilyRegistry::class,
                'sidus.family',
                'addFamily'
            )
        );
    }
540670
public function createContainer() : Container
    {
        $containerBuilder = new ContainerBuilder();

        foreach ($this->modules as $module) {
            $this->loadModule($containerBuilder, $module);
        }

        if (!empty($this->config)) {
            $containerBuilder->addDefinitions($this->config);
        }

        $this->configureContainerBuilder($containerBuilder);

        return $containerBuilder->build();
    }
857663
public function build(ContainerBuilder $container)
    {
        $this->initAdmingeneratorClassLoader($container);

        parent::build($container);

        $container->addCompilerPass(new ValidatorCompilerPass());
        $container->addCompilerPass(new FormCompilerPass());
    }
1128384
def init(cls, obj, context):
    """"""
    addr = statsId(obj)
    if addr not in cls.containerMap:
      cls.containerMap[addr] = cls.__getStatContainer(context)
    return cls.containerMap[addr]
179336
def _get_attrs(self, names):
        
        assert isinstance(names, str)
        names = names.replace(",", " ").split(" ")
        res = []
        for n in names:
            if n == "":
                continue
            if n not in self.__dict__:
                raise KeyError("Unknown name for Container attribute: '{}'".format(n))
            res.append(getattr(self, n))
        return res
734197
def p_ExtendedAttributeNoArgs(p):
  """"""
  p[0] = model.ExtendedAttribute(
    value=model.ExtendedAttributeValue(name=p[1]))
634098
private Attributes createAttributes(String[][] parameters)
    {
        AttributesImpl attributes = new AttributesImpl();

        if (parameters != null && parameters.length > 0) {
            for (String[] entry : parameters) {
                attributes.addAttribute(null, null, entry[0], null, entry[1]);
            }
        }

        return attributes;
    }
807524
def build(self, builder):
        """"""

        params = dict(
            OID=self.oid,
            Name=self.name,
            Repeating=bool_to_yes_no(self.repeating),
            Type=self.event_type,
        )

        if self.category is not None:
            params["Category"] = self.category

        if self.access_days is not None:
            params["mdsol:AccessDays"] = str(self.access_days)

        if self.start_win_days is not None:
            params["mdsol:StartWinDays"] = str(self.start_win_days)

        if self.target_days is not None:
            params["mdsol:TargetDays"] = str(self.target_days)

        if self.end_win_days is not None:
            params["mdsol:EndWinDays"] = str(self.end_win_days)

        if self.overdue_days is not None:
            params["mdsol:OverDueDays"] = str(self.overdue_days)

        if self.close_days is not None:
            params["mdsol:CloseDays"] = str(self.close_days)

        builder.start("StudyEventDef", params)
        for formref in self.formrefs:
            formref.build(builder)
        for alias in self.aliases:
            alias.build(builder)
        builder.end("StudyEventDef")
323419
def _container_stmt(self, stmt: Statement, sctx: SchemaContext) -> None:
        """"""
        self._handle_child(ContainerNode(), stmt, sctx)
386214
def build_attrs(self, *args, **kwargs):
        """"""
        attrs = super(HeavySelect2Mixin, self).build_attrs(*args, **kwargs)

        # encrypt instance Id
        self.widget_id = signing.dumps(id(self))

        attrs['data-field_id'] = self.widget_id
        attrs.setdefault('data-ajax--url', self.get_url())
        attrs.setdefault('data-ajax--cache', "true")
        attrs.setdefault('data-ajax--type', "GET")
        attrs.setdefault('data-minimum-input-length', 2)
        if self.dependent_fields:
            attrs.setdefault('data-select2-dependent-fields', " ".join(self.dependent_fields))

        attrs['class'] += ' django-select2-heavy'
        return attrs
1360581
def build(self, builder):
        """"""

        params = dict(
            OID=self.oid,
            Name=self.name,
            Repeating=bool_to_yes_no(self.repeating),
            IsReferenceData=bool_to_yes_no(self.is_reference_data),
        )

        if self.sas_dataset_name is not None:
            params["SASDatasetName"] = self.sas_dataset_name

        if self.domain is not None:
            params["Domain"] = self.domain

        if self.origin is not None:
            params["Origin"] = self.origin

        if self.role is not None:
            params["Role"] = self.role

        if self.purpose is not None:
            params["Purpose"] = self.purpose

        if self.comment is not None:
            params["Comment"] = self.comment

        builder.start("ItemGroupDef", params)

        for itemref in self.item_refs:
            itemref.build(builder)

        # Extensions always listed AFTER core elements
        for labelref in self.label_refs:
            labelref.build(builder)

        for alias in self.aliases:
            alias.build(builder)

        builder.end("ItemGroupDef")
333849
private function createContainer(): void
    {
        if (!$this->container) {
            $builder = new ContainerBuilder();
            $builder->addDefinitions([
                self::class => $this,
            ]);
            $this->container = $builder->build();
        }
    }
351914
def _container_factory(self, **options):
        
        ac_dict = options.get("ac_dict", False)
        _dicts = [x for x in (options.get(o) for o in self.dict_options())
                  if x]

        if self.dict_options() and ac_dict and callable(ac_dict):
            return ac_dict  # Higher priority than ac_ordered.
        if _dicts and callable(_dicts[0]):
            return _dicts[0]
        if self.ordered() and options.get("ac_ordered", False):
            return anyconfig.compat.OrderedDict

        return dict
378463
private static Set<PackingPlan.ContainerPlan> buildContainerPlans(
      Map<Integer, Container> containerInstances) {
    Set<PackingPlan.ContainerPlan> containerPlans = new LinkedHashSet<>();

    for (Integer containerId : containerInstances.keySet()) {
      Container container = containerInstances.get(containerId);
      if (container.getInstances().size() == 0) {
        continue;
      }

      Resource totalUsedResources = container.getTotalUsedResources();
      Resource resource = new Resource(
          Math.round(totalUsedResources.getCpu()),
          totalUsedResources.getRam(), totalUsedResources.getDisk());

      PackingPlan.ContainerPlan containerPlan =
          new PackingPlan.ContainerPlan(containerId, container.getInstances(), resource);

      containerPlans.add(containerPlan);
    }

    return containerPlans;
  }
552073
def factory(cls, attrs):
        """"""
        name = attrs['identifier'].capitalize()
        return type(name, (cls,), attrs)
235245
def find_default_container(builder,                  # type: HasReqsHints
                           default_container=None,   # type: Text
                           use_biocontainers=None,  # type: bool
                          ):  # type: (...) -> Optional[Text]
    """"""
    if not default_container and use_biocontainers:
        default_container = get_container_from_software_requirements(
            use_biocontainers, builder)
    return default_container