This function creates a new layer, gets a list of all the
        current attributes, and attempts to find matching environment variables
        with the prefix of FJS\_. If matches are found it sets those attributes
        in the new layer.
481770
def add_layer_from_env(self):
        
        self.add_layer()
        for attribute in self.get_attributes():
            env_attribute = os.environ.get('FJS_{}'.format(attribute))
            if env_attribute:
                setattr(self, attribute, env_attribute)
664330
def create_environment(preamble):
    
    environment = copy.deepcopy(os.environ)
    for line in preamble:
        logging.debug(line)
        if "=" in line and not line.startswith("#"):
            tmp = line.split("=")
            key = tmp[0].strip()
            value = tmp[1].strip()
            logging.debug(
                "Found variable {} with value {}".format(key, value))
            environment.update({key: value})
    logging.debug("Env {}".format(environment))
    return environment
1288575
def merge_env(self, env):
        
        # convert to dict to allow update
        current_env = dict(item.split('=') for item in self._env)

        # do validation and set new values.
        self.env = env

        # convert to dict to allow update
        new_env = dict(item.split('=') for item in self._env)

        # update old with new
        current_env.update(new_env)

        # apply updated values
        self.env = current_env
372658
function setEnvironment (settings) {
  // Choose between inherited environment and new environment:
  if (typeof settings.options.env !== "object") {
    settings.options.env = process.env;
  }

  // Set environment variables for GET and POST requests
  // if 'inputData' is available:
  if (settings.inputData) {
    settings.options.env = setInputEnvironmentVariables(settings);
  }

  return settings.options.env;
}
337094
def add_layer(self, obj=None):
        
        new_layer = Layer()
        if obj:
            new_layer.merge(obj)
        self.layers.append(new_layer)
1071855
def make_output_layers(self):
        
        self.output_layers = []
        # import pytest; pytest.set_trace()
        if hasattr(self.model, 'output_layers'):
            # find corresponding output layers in CoreML model
            # assume output layers are not shared
            # Helper function to recursively extract output layers
            # even if the model has a layer which is a nested model
            def extract_output_layers(keras_model):
                output_layers = []
                for layer in keras_model.output_layers:
                    if hasattr(layer,'output_layers'):
                        output_layers.extend(extract_output_layers(layer))
                    else:
                        output_layers.append(layer)
                return output_layers

            for kl in extract_output_layers(self.model):
                coreml_layers = self.get_coreml_layers(kl)
                if len(coreml_layers) > 0:
                    for cl in coreml_layers:
                        self.output_layers.append(cl)
        elif len(self.model.outputs) > 0:
            for model_output in self.model.outputs:
                for l in self.layer_list:
                    k_layer = self.keras_layer_map[l]
                    in_nodes = k_layer._inbound_nodes if hasattr(k_layer, '_inbound_nodes') else k_layer.inbound_nodes
                    for idx in range(len(in_nodes)):
                        out_tensor = k_layer.get_output_at(idx)
                        if out_tensor == model_output or (out_tensor.name in model_output.name):
                            self.output_layers.append(l)
        if len(self.output_layers) == 0:
            raise ValueError("No outputs can be identified")
697390
def new(cls, **kwargs):
        
        kwargs = cls.preprocess_kwargs_before_new(kwargs)
        if cls.__mapper__.polymorphic_on is not None:
            discriminator_key = cls.__mapper__.polymorphic_on.name
            discriminator_val = kwargs.get(discriminator_key)
            if discriminator_val is not None and discriminator_val in cls.__mapper__.polymorphic_map:
                actual_cls = cls.__mapper__.polymorphic_map[discriminator_val].class_
                return actual_cls(
                    **subdict(
                        actual_cls._preprocess_params(kwargs),
                        actual_cls.all_settable_keys())
                )
        return cls(**subdict(cls._preprocess_params(kwargs), cls.all_settable_keys()))
497194
def _insert_new_layers(self, new_layers, start_node_id, end_node_id):
        """"""
        new_node_id = self._add_node(deepcopy(self.node_list[end_node_id]))
        temp_output_id = new_node_id
        for layer in new_layers[:-1]:
            temp_output_id = self.add_layer(layer, temp_output_id)

        self._add_edge(new_layers[-1], temp_output_id, end_node_id)
        new_layers[-1].input = self.node_list[temp_output_id]
        new_layers[-1].output = self.node_list[end_node_id]
        self._redirect_edge(start_node_id, end_node_id, new_node_id)
670867
function(l){
        if(l.layersContext){
            for (var i = 0, len = l.layersContext.length; i < len; i++) {
                var layerContext = l.layersContext[i];
                var nPath = [];
                var nTitle = l.title || "";
                if(l.metadata && l.metadata.nestingPath){
                    nPath = l.metadata.nestingPath.slice();
                }
                if (nTitle != "") {
                    nPath.push(nTitle);
                }
                layerContext.metadata.nestingPath = nPath;
                if(layerContext.layersContext){
                    this.setNestingPath(layerContext);
                }
            }
        }
    }
1256124
function(prefix, f) {
    var retF = function(env) {
        Object.keys(env)
            .forEach(function(x) {
                var val = env[x];
                if ((typeof val === 'string') &&
                    (val.indexOf(prefix) === 0)) {
                    var propName = val.substring(prefix.length,
                                                 val.length);
                    env[x] = f(propName);
                } else if (Array.isArray(val)) {
                    retF(val);
                } else if (val && (typeof val === 'object')) {
                    retF(val);
                }
            });
    };
    return retF;
}
643884
def _create_nodes(self, env, target = None, source = None):
        
        src_suf = self.get_src_suffix(env)

        target_factory = env.get_factory(self.target_factory)
        source_factory = env.get_factory(self.source_factory)

        source = self._adjustixes(source, None, src_suf)
        slist = env.arg2nodes(source, source_factory)

        pre = self.get_prefix(env, slist)
        suf = self.get_suffix(env, slist)

        if target is None:
            try:
                t_from_s = slist[0].target_from_source
            except AttributeError:
                raise UserError("Do not know how to create a target from source `%s'" % slist[0])
            except IndexError:
                tlist = []
            else:
                splitext = lambda S: self.splitext(S,env)
                tlist = [ t_from_s(pre, suf, splitext) ]
        else:
            target = self._adjustixes(target, pre, suf, self.ensure_suffix)
            tlist = env.arg2nodes(target, target_factory, target=target, source=source)

        if self.emitter:
            # The emitter is going to do str(node), but because we're
            # being called *from* a builder invocation, the new targets
            # don't yet have a builder set on them and will look like
            # source files.  Fool the emitter's str() calls by setting
            # up a temporary builder on the new targets.
            new_targets = []
            for t in tlist:
                if not t.is_derived():
                    t.builder_set(self)
                    new_targets.append(t)

            orig_tlist = tlist[:]
            orig_slist = slist[:]

            target, source = self.emitter(target=tlist, source=slist, env=env)

            # Now delete the temporary builders that we attached to any
            # new targets, so that _node_errors() doesn't do weird stuff
            # to them because it thinks they already have builders.
            for t in new_targets:
                if t.builder is self:
                    # Only delete the temporary builder if the emitter
                    # didn't change it on us.
                    t.builder_set(None)

            # Have to call arg2nodes yet again, since it is legal for
            # emitters to spit out strings as well as Node instances.
            tlist = env.arg2nodes(target, target_factory,
                                  target=orig_tlist, source=orig_slist)
            slist = env.arg2nodes(source, source_factory,
                                  target=orig_tlist, source=orig_slist)

        return tlist, slist
747617
def new_context(environment, template_name, blocks, vars=None,
                shared=None, globals=None, locals=None):
    """"""
    if vars is None:
        vars = {}
    if shared:
        parent = vars
    else:
        parent = dict(globals or (), **vars)
    if locals:
        # if the parent is shared a copy should be created because
        # we don't want to modify the dict passed
        if shared:
            parent = dict(parent)
        for key, value in iteritems(locals):
            if value is not missing:
                parent[key] = value
    return environment.context_class(environment, parent, template_name,
                                     blocks)
206718
def create_new_environment(project_root, environment_name)
      # Check if the environment exist
      return error(_('wizard.environment.name_exist')%{environment: environment_name}) if Bebox::Environment.environment_exists?(project_root, environment_name)
      # Environment creation
      environment = Bebox::Environment.new(environment_name, project_root)
      output = environment.create
      ok _('wizard.environment.creation_success')
      return output
    end
292958
def prepare_new_layer(self, input_layer):
        
        # create memory layer
        output_layer_name = os.path.splitext(input_layer.name())[0]
        output_layer_name = unique_filename(
            prefix=('%s_minimum_needs_' % output_layer_name),
            dir='minimum_needs_calculator')
        output_layer = create_memory_layer(
            output_layer_name,
            input_layer.geometryType(),
            input_layer.crs(),
            input_layer.fields())

        # monkey patching input layer to make it work with
        # prepare vector layer function
        temp_layer = input_layer
        temp_layer.keywords = {
            'layer_purpose': layer_purpose_aggregation['key']}

        # copy features to output layer
        copy_layer(temp_layer, output_layer)

        # Monkey patching output layer to make it work with
        # minimum needs calculator
        output_layer.keywords['layer_purpose'] = (
            layer_purpose_aggregation['key'])
        output_layer.keywords['inasafe_fields'] = {
            displaced_field['key']: self.displaced.currentField()
        }
        if self.aggregation_name.currentField():
            output_layer.keywords['inasafe_fields'][
                aggregation_name_field['key']] = (
                    self.aggregation_name.currentField())

        # remove unnecessary fields & rename inasafe fields
        clean_inasafe_fields(output_layer)

        return output_layer
1189562
def create_attributes(klass, attributes, previous_object=None):
        

        result = super(Webhook, klass).create_attributes(attributes, previous_object)

        if 'topics' not in result:
            raise Exception("Topics ('topics') must be provided for this operation.")
        return result
1184219
def init_layer(self):
        
        self.layer = self.vector.GetLayer()
        self.__features = [None] * self.nfeatures
825697
def new(self, layer_groups:Collection[nn.Module], split_no_wd:bool=True):
        ""
        opt_func = getattr(self, 'opt_func', self.opt.__class__)
        res = self.create(opt_func, self.lr, layer_groups, wd=self.wd, true_wd=self.true_wd, bn_wd=self.bn_wd)
        res.mom,res.beta = self.mom,self.beta
        return res