Helper for deriving the current state of the container from the inspect
    results.
495336
def _get_state(inspect_results):
    '''
    
    '''
    if inspect_results.get('State', {}).get('Paused', False):
        return 'paused'
    elif inspect_results.get('State', {}).get('Running', False):
        return 'running'
    else:
        return 'stopped'
1211566
def get_state(self):
        

        self.step_methods = set()
        for s in self.stochastics:
            self.step_methods |= set(self.step_method_dict[s])

        state = Sampler.get_state(self)
        state['step_methods'] = {}

        # The state of each StepMethod.
        for sm in self.step_methods:
            state['step_methods'][sm._id] = sm.current_state().copy()

        return state
235863
def containerIsRunning(name_or_id):
    ''''''
    require_str("name_or_id", name_or_id)

    try:
        container = getContainer(name_or_id)
        # Refer to the latest status list here: https://docs.docker.com/engine/
        #   api/v1.33/#operation/ContainerList
        if container:
            if container.status == 'created':
              return False
            elif container.status == 'restarting':
              return True
            elif container.status == 'running':
              return True
            elif container.status == 'removing':
              return False
            elif container.status == 'paused':
              return False
            elif container.status == 'exited':
              return False
            elif container.status == 'dead':
              return False
            else:
              return False
    except NotFound as exc:
        return False

    return False
575275
def get_current_service_state(self, service_id: str):
        """"""
        state = self._get_service_state(service_id)
        return state.current_state
1257481
function inspect (p) {
    if (!isObject(p.params)) p.params = { value: p.params }
    if (p.params.error !== undefined) {
      p.params = { error: p.params.error } // discard all fields but the error field
      p.s.state = -1 // abort unless there is a handler in the stack
      while (p.s.stack.length > 0 && !p.s.stack[0].marker) {
        if ((p.s.state = p.s.stack.shift().catch || -1) >= 0) break
      }
    }
  }
334176
def get_state(self, sls, saltenv, cachedir=None):
        '''
        
        '''
        if '.' in sls:
            sls = sls.replace('.', '/')
        sls_url = salt.utils.url.create(sls + '.sls')
        init_url = salt.utils.url.create(sls + '/init.sls')
        for path in [sls_url, init_url]:
            dest = self.cache_file(path, saltenv, cachedir=cachedir)
            if dest:
                return {'source': path, 'dest': dest}
        return {}
699707
def inspect(self):
        
        policy = self.policy
        config_id = self.config_id
        if self.config_id.config_type == ItemType.VOLUME:
            if self.container_map.use_attached_parent_name:
                container_name = policy.aname(config_id.map_name, config_id.instance_name, config_id.config_name)
            else:
                container_name = policy.aname(config_id.map_name, config_id.instance_name)
        else:
            container_name = policy.cname(config_id.map_name, config_id.config_name, config_id.instance_name)

        self.container_name = container_name
        if container_name in policy.container_names[self.client_name]:
            self.detail = self.client.inspect_container(container_name)
        else:
            self.detail = NOT_FOUND
520194
public static function getContainerStates()
    {
        return array(
            ContainerStateKeys::HALT,
            ContainerStateKeys::WAITING_FOR_INITIALIZATION,
            ContainerStateKeys::INITIALIZATION_SUCCESSFUL,
            ContainerStateKeys::DEPLOYMENT_SUCCESSFUL,
            ContainerStateKeys::SERVERS_STARTED_SUCCESSFUL,
            ContainerStateKeys::SHUTDOWN
        );
    }
517609
def state(self):
    """"""
    ev = self._query_waiters.request(self.__do_query_state)
    ev.wait(1.0)
    return self._state
455017
def inspect_built_image(self):
        
        logger.info("inspecting built image '%s'", self.image_id)
        self.ensure_is_built()
        # dict with lots of data, see man docker-inspect
        inspect_data = self.tasker.inspect_image(self.image_id)
        return inspect_data
104044
def _parse_inspection_output(self, output):
        
        parts = {'variables': [], 'builders': [], 'provisioners': []}
        for line in output.splitlines():
            line = line.split(',')
            if line[2].startswith('template'):
                del line[0:2]
                component = line[0]
                if component == 'template-variable':
                    variable = {"name": line[1], "value": line[2]}
                    parts['variables'].append(variable)
                elif component == 'template-builder':
                    builder = {"name": line[1], "type": line[2]}
                    parts['builders'].append(builder)
                elif component == 'template-provisioner':
                    provisioner = {"type": line[1]}
                    parts['provisioners'].append(provisioner)
        return parts
78462
def get(self, container):
        
        name = utils.get_name(container)
        uri = "/%s" % name
        resp, resp_body = self.api.method_head(uri)
        hdrs = resp.headers
        data = {"total_bytes": int(hdrs.get("x-container-bytes-used", "0")),
                "object_count": int(hdrs.get("x-container-object-count", "0")),
                "name": name}
        return Container(self, data, loaded=False)
1079368
def get_stats(self, container_id):
        
        return self._docker.containers.get(container_id).stats(decode=True)
371460
function(){
		var finished = true,
			now = Date.now(),
			options = render.options,
			results = options.results ? render._normalizePath( options.results ) : null;

		// Wait until all modules have been triggered before checking states
		if ( render.state < munit.RENDER_STATE_ACTIVE ) {
			return;
		}

		// Can only check an active munit
		render.requireState( munit.RENDER_STATE_ACTIVE, render.check );

		// Check each module
		munit.each( munit.ns, function( mod, name ) {
			if ( mod.state < munit.ASSERT_STATE_FINISHED ) {
				return ( finished = false );
			}
		});

		// Check dependency chains if test suite isn't yet finished
		if ( ! finished ) {
			munit.queue.check();

			// Check each untriggered module to see if it's dependencies have been closed
			munit.tests.forEach(function( assert ) {
				if ( assert.state === munit.ASSERT_STATE_DEFAULT && ! assert.option( 'queue' ) && render.checkDepency( assert ) ) {
					assert.trigger();
				}
			});
		}
		// Only flush full results once all modules have completed
		else {
			render.state = munit.RENDER_STATE_FINISHED;
			munit.end = now;

			// Print out test results
			if ( results && results.length ) {
				render._renderResults( results + '/' );
			}
			else {
				render._complete();
			}
		}
	}
884325
def inspect_current_object(self):
        """"""
        editor = self.get_current_editor()
        editor.sig_display_signature.connect(self.display_signature_help)
        line, col = editor.get_cursor_line_column()
        editor.request_hover(line, col)
681520
def get_current_state(self):
        """"""
        def clean_state(dictionary):
            """Clean dictionary from bad value.

            :param dictionary: Dictionary of value maps or thresholds.
            :type dictionary: dict

            :returns: Clean state.
            :rtype: dict
            """
            clean_dictionary = {
                k: v for k, v in list(dictionary.items())
                if isinstance(v, dict)}

            return clean_dictionary

        if self.layer_mode == layer_mode_continuous:
            output = {'thresholds': clean_state(self.thresholds)}
            key = 'thresholds'
        else:
            output = {'value_maps': clean_state(self.value_maps)}
            key = 'value_maps'

        # Clean non existing hazard class key
        empty_exposure_classifications = []
        for the_exposure, the_hazard_classifications in list(
                output[key].items()):
            for the_hazard_classification in list(the_hazard_classifications.
                                                  keys()):
                invalid_classifications = []
                if not definition(the_hazard_classification):
                    invalid_classifications.append(
                        the_hazard_classification)
                for invalid_classification in invalid_classifications:
                    the_hazard_classifications.pop(invalid_classification)
            if not the_hazard_classifications:
                empty_exposure_classifications.append(the_exposure)

        for empty_exposure_classification in empty_exposure_classifications:
            output[key].pop(empty_exposure_classification)

        return output
1215590
def get_initial_state(self):
        '''
            
        '''
        if not self.assignment.attachment_is_tested():
            return Submission.SUBMITTED
        else:
            if self.assignment.attachment_test_validity:
                return Submission.TEST_VALIDITY_PENDING
            elif self.assignment.attachment_test_full:
                return Submission.TEST_FULL_PENDING