Return ContextService arguments for an LXD container connection.
519487
def _connect_lxd(spec):
    
    return {
        'method': 'lxd',
        'kwargs': {
            'container': spec.remote_addr(),
            'python_path': spec.python_path(),
            'lxc_path': spec.mitogen_lxc_path(),
            'connect_timeout': spec.ansible_ssh_timeout() or spec.timeout(),
            'remote_name': get_remote_name(spec),
        }
    }
590802
def _container_getitem(instance, elts, index, context=None):
    """"""
    try:
        if isinstance(index, Slice):
            index_slice = _infer_slice(index, context=context)
            new_cls = instance.__class__()
            new_cls.elts = elts[index_slice]
            new_cls.parent = instance.parent
            return new_cls
        if isinstance(index, Const):
            return elts[index.value]
    except IndexError as exc:
        raise exceptions.AstroidIndexError(
            message="Index {index!s} out of range",
            node=instance,
            index=index,
            context=context,
        ) from exc
    except TypeError as exc:
        raise exceptions.AstroidTypeError(
            message="Type error {error!r}", node=instance, index=index, context=context
        ) from exc

    raise exceptions.AstroidTypeError("Could not use %s as subscript index" % index)
53076
def getContext(self):
        """"""
        ctx = SSL.Context(SSL.SSLv23_METHOD)
        ctx.use_certificate_file('server.pem')
        ctx.use_privatekey_file('server.pem')
        return ctx
193790
def context(self, name):
        
        data = self._context(name)
        context = data.get("context")
        if context:
            return context

        assert self.load_path
        context_path = os.path.join(self.load_path, "contexts", "%s.rxt" % name)
        context = ResolvedContext.load(context_path)
        data["context"] = context
        data["loaded"] = True
        return context
122319
def parameters(self, namespaced=False):
        """"""
        if namespaced:
            return json.loads(json.dumps(self.args[0]['parameters']), object_hook=lambda d: SimpleNamespace(**d))
        else:
            return self.args[0].get('parameters')
246215
def _load(self, **kwargs):
        '''
        '''
        # Some kwargs should be popped before we do a load
        for key in self._meta_data['disallowed_load_parameters']:
            if key in kwargs:
                kwargs.pop(key)

        self._check_load_parameters(**kwargs)
        name = kwargs.pop('name', '')
        partition = kwargs.pop('partition', '')
        read_session = self._meta_data['icr_session']
        base_uri = self._meta_data['container']._meta_data['uri']

        load_uri = self._build_service_uri(base_uri, partition, name)
        response = read_session.get(load_uri, uri_as_parts=False, **kwargs)
        return self._produce_instance(response)
810538
def get_context(request, context=None):
    """"""
    if context is None:
        context = {}

    network_config = getattr(settings, 'OPENSTACK_NEUTRON_NETWORK', {})

    context['launch_instance_allowed'] = policy.check(
        (("compute", "os_compute_api:servers:create"),), request)
    context['instance_quota_exceeded'] = _quota_exceeded(request, 'instances')
    context['create_network_allowed'] = policy.check(
        (("network", "create_network"),), request)
    context['network_quota_exceeded'] = _quota_exceeded(request, 'network')
    context['create_router_allowed'] = (
        network_config.get('enable_router', True) and
        policy.check((("network", "create_router"),), request))
    context['router_quota_exceeded'] = _quota_exceeded(request, 'router')
    context['console_type'] = getattr(settings, 'CONSOLE_TYPE', 'AUTO')
    context['show_ng_launch'] = (
        base.is_service_enabled(request, 'compute') and
        getattr(settings, 'LAUNCH_INSTANCE_NG_ENABLED', True))
    context['show_legacy_launch'] = (
        base.is_service_enabled(request, 'compute') and
        getattr(settings, 'LAUNCH_INSTANCE_LEGACY_ENABLED', False))
    return context
911150
def get_context_for_help_msgs(self, context_dict):
        
        context_dict = copy(context_dict)
        context_dict['wrapped_func'] = get_callable_name(context_dict['wrapped_func'])
        return context_dict
681345
def _get_container(self, path):
        """"""
        cont = self.native_conn.get_container(path)
        return self.cont_cls(self,
                             cont.name,
                             cont.object_count,
                             cont.size_used)
312706
def context_list(zap_helper):
    """"""
    contexts = zap_helper.zap.context.context_list
    if len(contexts):
        console.info('Available contexts: {0}'.format(contexts[1:-1]))
    else:
        console.info('No contexts available in the current session')
593524
def make_context(self, **kwargs):
        """"""
        self.check_schema()
        return Context(self.driver, self.config, **kwargs)
224422
def get_parsed_context(context_arg):
    """"""
    if not context_arg:
        logger.debug("pipeline invoked without context arg set. For "
                     "this json parser you're looking for something "
                     "like: "
                     "pypyr pipelinename '{\"key1\":\"value1\","
                     "\"key2\":\"value2\"}'")
        return None

    logger.debug("starting")
    # deserialize the input context string into json
    return json.loads(context_arg)
672700
function pluginServicesExec(args, context) {
		var result = document.createElement("div"); //$NON-NLS-0$
		var services = args.plugin.getServiceReferences();
		services.forEach(function(service) {
			var current = {values: []};
			var keys = service.getPropertyKeys();
			keys.forEach(function(key) {
				if (key === "service.names") { //$NON-NLS-0$
					current.name = service.getProperty(key).join();
				}
				if (key === "id") {
					current.id = service.getProperty(key);
				}
				current.values.push({name: key, value: service.getProperty(key)});
			});
			if (current.name) {
				current.elementId = "serviceElement" + serviceElementCounter++; //$NON-NLS-0$
				current.values.forEach(function(value) {
					value.elementId = "serviceElement" + serviceElementCounter++; //$NON-NLS-0$
				});
				var parent = document.createElement("div"); //$NON-NLS-0$
				result.appendChild(parent);
				var renderer = new ServicesRenderer();
				var tableTree = new mTreeTable.TableTree({
					model: new ServicesModel(current),
					showRoot: true,
					parent: parent,
					renderer: renderer
				});
				renderer.tableTree = tableTree;
			}
		});
		return result;
	}
241459
def get_context(self, name):
        """"""
        contexts = self.data['contexts']
        for context in contexts:
            if context['name'] == name:
                return context
        raise KubeConfError("context name not found.")
1115170
def get_selinux_context(path):
    '''
    
    '''
    out = __salt__['cmd.run'](['ls', '-Z', path], python_shell=False)

    try:
        ret = re.search(r'\w+:\w+:\w+:\w+', out).group(0)
    except AttributeError:
        ret = (
            'No selinux context information is available for {0}'.format(path)
        )

    return ret
1299884
def get_context_data(self, *args, **kwargs):
		""""""
		context = super().get_context_data(**kwargs)
		context["is_plans_plural"] = Plan.objects.count() > 1
		context["customer"], _created = Customer.get_or_create(
			subscriber=djstripe_settings.subscriber_request_callback(self.request)
		)
		context["subscription"] = context["customer"].subscription
		return context
824513
def getContext(context):
    
    context = aq_parent(aq_base(context))
    if not context or IBrowserView.providedBy(context):
        return getSite()
    return context