:type installation_context: context.InstallationContext

        :rtype: dict
773142
def serialize(cls, installation_context):
        

        return {
            cls._FIELD_TOKEN: installation_context.token,
            cls._FIELD_PUBLIC_KEY_CLIENT: security.public_key_to_string(
                installation_context.private_key_client.publickey()
            ),
            cls._FIELD_PRIVATE_KEY_CLIENT: security.private_key_to_string(
                installation_context.private_key_client
            ),
            cls._FIELD_PUBLIC_KEY_SERVER: security.public_key_to_string(
                installation_context.public_key_server
            ),
        }
661630
def insert(self, context):
	
		
		
		module_file = open(context.resolve(self.__path), "rb")
		data = {
			"name": self.__name
		}
		if self.__context_root is not None:
			data["contextroot"] = self.__context_root
		status_code, msg = self.__endpoint.post(
			"/applications/application",
			data=data,
			files={
				"id": module_file
			},
			timeout=60.
		)
		module_file.close()
		self.__available = True
105615
def _context_string_to_dict(context):
    '''
    
    '''
    if not re.match('[^:]+:[^:]+:[^:]+:[^:]+$', context):
        raise SaltInvocationError('Invalid SELinux context string: {0}. ' +
                                  'Expected "sel_user:sel_role:sel_type:sel_level"')
    context_list = context.split(':', 3)
    ret = {}
    for index, value in enumerate(['sel_user', 'sel_role', 'sel_type', 'sel_level']):
        ret[value] = context_list[index]
    return ret
123888
def get_context_data(cls, instance):
        '''
        
        '''

        context_engine_id = None
        context_name = ''

        if "user" in instance:
            if 'context_engine_id' in instance:
                context_engine_id = OctetString(instance['context_engine_id'])
            if 'context_name' in instance:
                context_name = instance['context_name']

        return context_engine_id, context_name
66695
def import_context(cls, context):
		
		if context is None or len(context) == 0:
			return

		result = WContext(context[0][0], context[0][1])
		for iter_context in context[1:]:
			result = WContext(iter_context[0], context_value=iter_context[1], linked_context=result)
		return result
187268
def get_context(awsclient, env, tool, command, arguments=None):
    
    # TODO: elapsed, artifact(stack, depl-grp, lambda, api)
    if arguments is None:
        arguments = {}
    context = {
        '_awsclient': awsclient,
        'env': env,
        'tool': tool,
        'command': command,
        '_arguments': arguments,  # TODO clean up arguments -> args
        'version': __version__,
        'user': _get_user(),
        'plugins': get_plugin_versions().keys()
    }

    return context
372848
def _context_defines(self, context, conf):
        
        if conf and 'defines' in conf and isinstance(conf['defines'], dict):
            context.update(conf['defines'])
        if hasattr(self, '_legion'):
            roles = self._legion.get_roles()
        else:
            roles = self.get_roles()
        if conf and roles and 'role_defines' in conf and isinstance(conf['role_defines'], dict):
            for role in conf['role_defines']:
                if role in roles:
                    context.update(conf['role_defines'][role])
246727
def registration_settings(request):
    ''''''
    context = {}
    for setting in (
            'WAFER_SSO',
            'WAFER_HIDE_LOGIN',
            'WAFER_REGISTRATION_OPEN',
            'WAFER_REGISTRATION_MODE',
            'WAFER_TALKS_OPEN',
            'WAFER_VIDEO_LICENSE',
    ):
        context[setting] = getattr(settings, setting, None)
    return context
520204
def inject_context(context):
    
    context_path = tasks.get_context_path()
    try:
        new_context = json.loads(context)
    except ValueError:
        print('Couldn\'t load context parameter')
        return
    with open(context_path) as jsonfile:
        try:
            jsondata = json.loads(jsonfile.read())
            jsondata.update(new_context)
        except ValueError:
            print('Couldn\'t read context.json')
            return
    with open(context_path, 'w') as jsoncontent:
        json.dump(jsondata, jsoncontent, indent=4)
379785
def context_structure(self):
        
        instructions = []
        last_context = Context()
        for instr in self.structure:
            instruction_type = instr['instruction']
            if instruction_type == "FROM":  # reset per stage
                last_context = Context()

            context = Context(envs=dict(last_context.envs),
                              labels=dict(last_context.labels))

            if instruction_type in ["ENV", "LABEL"]:
                val = get_key_val_dictionary(instruction_value=instr['value'],
                                             env_replace=self.env_replace,
                                             envs=last_context.envs)
                context.set_line_value(context_type=instruction_type, value=val)

            instructions.append(context)
            last_context = context
        return instructions
556244
def get_context(self):
        
        ctx = {}
        for clause in self.where_clauses or []:
            clause.update_context(ctx)
        return ctx
382295
def load(self):
        
        if self._defaults_file is not None:
            if not os.path.exists(self._defaults_file):
                msg = "Unable to find defaults file: {}".format(self._defaults_file)
                LOGGER.error(msg)
                raise RuntimeError(msg)
            with open(self._defaults_file, 'r') as handle:
                self._defaults = json.load(handle)
                self.update(self._defaults)

        if self._settings_file is None:
            msg = "No context file has been provided"
            LOGGER.error(msg)
            raise RuntimeError(msg)
        if not os.path.exists(self._settings_file):
            msg = "Unable to find settings file: {}".format(self._settings_file)
            LOGGER.error(msg)
            raise RuntimeError(msg)
        with open(self._settings_file, 'r') as handle:
            settings = json.load(handle)
            update(self, settings)

        return
1093264
def get(self, sid):
        
        return BuildContext(self._version, service_sid=self._solution['service_sid'], sid=sid, )
827650
def inject_context(self, __context_dict__=None, **context):
        
        context = context or __context_dict__
        self.context_keys |= set(context.keys())
        for key, value in context.items():
            setattr(self, key, value)
        for command in self.subcommands.values():
            command.inject_context(context)
258355
def context(root, project=""):
    

    environment = os.environ.copy()
    environment.update({
        "BE_PROJECT": project,
        "BE_PROJECTROOT": (
            os.path.join(root, project).replace("\\", "/")
            if project else ""),
        "BE_PROJECTSROOT": root,
        "BE_ALIASDIR": "",
        "BE_CWD": root,
        "BE_CD": "",
        "BE_ROOT": "",
        "BE_TOPICS": "",
        "BE_DEVELOPMENTDIR": "",
        "BE_ACTIVE": "1",
        "BE_USER": "",
        "BE_SCRIPT": "",
        "BE_PYTHON": "",
        "BE_ENTER": "",
        "BE_TEMPDIR": "",
        "BE_PRESETSDIR": "",
        "BE_GITHUB_API_TOKEN": "",
        "BE_ENVIRONMENT": "",
        "BE_BINDING": "",
        "BE_TABCOMPLETION": ""
    })

    return environment
158563
def create_context(ctx):
    
    ctx_cls_name = ctx.get("class", "insights.core.context.HostContext")
    if "." not in ctx_cls_name:
        ctx_cls_name = "insights.core.context." + ctx_cls_name
    ctx_cls = dr.get_component(ctx_cls_name)
    ctx_args = ctx.get("args", {})
    return ctx_cls(**ctx_args)
114586
def init_with_context(self, context):
        
        site_name = get_admin_site_name(context)

        self.children += [
            items.MenuItem(_('Dashboard'), reverse('{0}:index'.format(site_name))),
            items.Bookmarks(),
        ]

        for title, kwargs in get_application_groups():
            if kwargs.get('enabled', True):
                self.children.append(CmsModelList(title, **kwargs))

        self.children += [
            ReturnToSiteItem()
        ]