Returns the container object assigned to the slot passed in

        :param slot: the slot where the analyses are located
        :type slot: int
        :return: the container (analysis request, reference sample, etc.)
545541
def get_container_at(self, slot):
        

        # ensure we have an integer
        slot = to_int(slot)

        if slot < 1:
            return None

        layout = self.getLayout()

        for pos in layout:
            layout_slot = to_int(pos['position'])
            uid = pos['container_uid']
            if layout_slot != slot or not uid:
                continue
            return api.get_object_by_uid(uid)

        return None
37859
def stat_container(self, container):
        
        LOG.debug('stat_container() with %s is success.', self.driver)
        return self.driver.stat_container(container)
291045
def get_container_for(self, instance):
        
        if IReferenceAnalysis.providedBy(instance):
            return api.get_uid(instance.getSample())
        return instance.getRequestUID()
979735
def slot_obj_dict(o):
    
    d = {}
    for f in o.__slots__:
        d[f] = getattr(o, f, None)
    return d
1219456
def names_container(self):
        
        if not self.stream:
            return os.path.isdir(self.object_name)
        else:
            return False
825518
def assigned_state(instance):
    
    analyses = instance.getAnalyses()
    if not analyses:
        return "unassigned"
    for analysis in analyses:
        analysis_object = api.get_object(analysis)
        if not analysis_object.getWorksheet():
            return "unassigned"
    return "assigned"
497667
def _superdir(self):
        
        attrs = set()
        cls = self.__class__
        if hasattr(cls, '__all_slots__'):
            attrs.update(cls.__all_slots__)
        for bcls in cls.__mro__:
            if hasattr(bcls, '__dict__'):
                attrs.update(bcls.__dict__)
        return attrs
222195
def get_container_mapping(self):
        
        layout = self.context.getLayout()
        container_mapping = {}
        for slot in layout:
            if slot["type"] != "a":
                continue
            position = slot["position"]
            container_uid = slot["container_uid"]
            container_mapping[container_uid] = position
        return container_mapping
783763
def aliased_slot_name(self, slot: SLOT_OR_SLOTNAME) -> str:
        
        if isinstance(slot, str):
            slot = self.schema.slots[slot]
        return slot.alias if slot.alias else slot.name
474417
def _return_base_data(self, url, container, container_object=None,
                          container_headers=None, object_headers=None):
        
        headers = self.job_args['base_headers']
        headers.update({'X-Auth-Token': self.job_args['os_token']})

        _container_uri = url.geturl().rstrip('/')

        if container:
            _container_uri = '%s/%s' % (
                _container_uri, cloud_utils.quoter(container)
            )

        if container_object:
            _container_uri = '%s/%s' % (
                _container_uri, cloud_utils.quoter(container_object)
            )

        if object_headers:
            headers.update(object_headers)

        if container_headers:
            headers.update(container_headers)

        return headers, urlparse.urlparse(_container_uri)
154166
def connect(self, slot):
        
        if not callable(slot):
            raise ValueError("Connection to non-callable '%s' object failed" % slot.__class__.__name__)

        if (isinstance(slot, partial) or '<' in slot.__name__):
            # If it's a partial or a lambda. The '<' check is the only py2 and py3 compatible way I could find
            if slot not in self._slots:
                self._slots.append(slot)
        elif inspect.ismethod(slot):
            # Check if it's an instance method and store it with the instance as the key
            slotSelf = slot.__self__
            slotDict = weakref.WeakKeyDictionary()
            slotDict[slotSelf] = slot.__func__
            if slotDict not in self._slots:
                self._slots.append(slotDict)
        else:
            # If it's just a function then just store it as a weakref.
            newSlotRef = weakref.ref(slot)
            if newSlotRef not in self._slots:
                self._slots.append(newSlotRef)
1062029
def primary_keys_for(self, cls: ClassDefinition) -> List[SlotDefinitionName]:
        
        return [slot_name for slot_name in self.all_slots_for(cls)
                if self.schema.slots[slot_name].primary_key or self.schema.slots[slot_name].identifier]
1333032
def get_slot_header_data(self, obj):
        

        item_obj = None
        item_title = ""
        item_url = ""
        item_img = ""
        item_img_url = ""
        item_img_text = ""
        additional_item_icons = []

        parent_obj = None
        parent_title = ""
        parent_url = ""
        parent_img = ""
        parent_img_text = ""
        additional_parent_icons = []

        sample_type_obj = None
        sample_type_title = ""
        sample_type_url = ""
        sample_type_img = ""
        sample_type_img_text = ""

        if IDuplicateAnalysis.providedBy(obj):
            # item
            request = obj.getRequest()
            item_obj = request
            item_title = api.get_id(request)
            item_url = api.get_url(request)
            item_img = "duplicate.png"
            item_img_url = api.get_url(request)
            item_img_text = t(_("Duplicate"))
            # additional item icons
            additional_item_icons.append(
                self.render_remarks_tag(request))
            # parent
            client = request.getClient()
            parent_obj = client
            parent_title = api.get_title(client)
            parent_url = api.get_url(client)
            parent_img = "client.png"
            parent_img_text = t(_("Client"))
            # sample type
            sample_type = request.getSampleType()
            sample_type_title = request.getSampleTypeTitle()
            sample_type_url = api.get_url(sample_type)
            sample_type_img = "sampletype.png"
            sample_type_img_text = t(_("Sample Type"))
        elif IReferenceAnalysis.providedBy(obj):
            # item
            sample = obj.getSample()
            item_obj = sample
            item_title = api.get_id(sample)
            item_url = api.get_url(sample)
            item_img_url = api.get_url(sample)
            item_img = "control.png"
            item_img_text = t(_("Control"))
            if obj.getReferenceType() == "b":
                item_img = "blank.png"
                item_img_text = t(_("Blank"))
            # parent
            supplier = obj.getSupplier()
            parent_obj = supplier
            parent_title = api.get_title(supplier)
            parent_url = api.get_url(supplier)
            parent_img = "supplier.png"
            parent_img_text = t(_("Supplier"))
        elif IRoutineAnalysis.providedBy(obj):
            # item
            request = obj.getRequest()
            item_obj = request
            item_title = api.get_id(request)
            item_url = api.get_url(request)
            item_img = "sample.png"
            item_img_url = api.get_url(request)
            item_img_text = t(_("Sample"))
            # additional item icons
            additional_item_icons.append(
                self.render_remarks_tag(request))
            # parent
            client = obj.getClient()
            parent_obj = client
            parent_title = api.get_title(client)
            parent_url = api.get_url(client)
            parent_img = "client.png"
            parent_img_text = t(_("Client"))
            # sample type
            sample_type = obj.getSampleType()
            sample_type_title = obj.getSampleTypeTitle()
            sample_type_url = api.get_url(sample_type)
            sample_type_img = "sampletype.png"
            sample_type_img_text = t(_("Sample Type"))

        return {
            # item
            "item_obj": item_obj,
            "item_title": item_title,
            "item_url": item_url,
            "item_img": get_image(item_img, title=item_img_text),
            "item_img_url": item_img_url,
            "additional_item_icons": additional_item_icons,
            # parent
            "parent_obj": parent_obj,
            "parent_title": parent_title,
            "parent_url": parent_url,
            "parent_img": get_image(parent_img, title=parent_img_text),
            "additional_parent_icons": additional_parent_icons,
            # sample type
            "sample_type_obj": sample_type_obj,
            "sample_type_title": sample_type_title,
            "sample_type_url": sample_type_url,
            "sample_type_img": get_image(
                sample_type_img, title=sample_type_img_text),
        }
710912
def to_dict(self) -> dict:
        
        return {
            key: getattr(self, key)
            for key in self.__slots__
            if getattr(self, key) is not None
        }
119088
def get_container(cls, scheduler):
        
        if scheduler in cls._container_cache:
            return cls._container_cache[scheduler]
        else:
            c = cls(scheduler)
            cls._container_cache[scheduler] = c
            return c
528617
def inspect(self, refresh=True):
        
        if refresh or not self._inspect_data:
            identifier = self._id or self.name
            if not identifier:
                raise ConuException("This container does not have a valid identifier.")
            self._inspect_data = self._inspect(identifier)
        return self._inspect_data
852991
def get_containers():
        
        LOGGER.debug("ContainerService.get_containers")
        params = SessionService.complete_transactional_req(None)
        if params is None:
            if MappingService.driver_type != DriverFactory.DRIVER_REST:
                params = {'OPERATION': 'getContainers'}
                args = {'properties': params}
            else:
                args = {'http_operation': 'GET', 'operation_path': ''}
        else:
            if MappingService.driver_type != DriverFactory.DRIVER_REST:
                params["OPERATION"] = "getContainers"
                args = {'properties': params}
            else:
                args = {'http_operation': 'GET', 'operation_path': '', 'parameters': params}

        response = ContainerService.requester.call(args)

        if MappingService.driver_type != DriverFactory.DRIVER_REST:
            response = response.get()

        ret = None
        if response.rc == 0:
            ret = []
            for container in response.response_content['containers']:
                ret.append(Container.json_2_container(container))
        elif response.rc != 404:
            err_msg = 'ContainerService.get_containers - Problem while getting containers. ' \
                      'Reason: ' + str(response.response_content) + ' - ' + str(response.error_message) + \
                      " (" + str(response.rc) + ")"
            LOGGER.warning(err_msg)
            if response.rc == 500 and ArianeMappingOverloadError.ERROR_MSG in response.error_message:
                raise ArianeMappingOverloadError("ContainerService.get_containers",
                                                 ArianeMappingOverloadError.ERROR_MSG)
            # traceback.print_stack()
        return ret