Assigns the given subject to the topic
178767
def assign(self, subject):
        
        if not isinstance(subject, (Publisher, Subscriber)):
            raise TypeError('Assignee has to be Publisher or Subscriber')

        # check if not already assigned
        if self._subject is not None:
            raise SubscriptionError('Topic %r already assigned' % self._path)

        self._subject = subject

        # subscribe to subject if topic has subscriptions
        if self._subscriptions:
            self._subject.subscribe(self)

        # if topic received emits before assignment replay those emits
        if self._pre_assign_emit is not None:
            for value in self._pre_assign_emit:
                self._subject.emit(value, who=self)
            self._pre_assign_emit = None

        return subject
656912
def add_child(self, label_str, type_str):
        """"""
        child_node = SubjectInfoNode(label_str, type_str)
        child_node.parent = self
        self.child_list.append(child_node)
        return child_node
470370
public function setSubject($subject = '')
    {
        $this->subject = $subject;
        $this->debug->debug(__FUNCTION__, 'setSubject: ', $this->subject);
    }
817350
def notify(self, topic, **kwargs):
        '''
        
        '''
        kwargs['name'] = self._name
        self._engine._notify(topic, **kwargs)
656617
public function setSubject($subject)
    {
        $node = $this->getSubject(false);
        if(!$node){
            $node = $this->createElement('subject');
            $this->doc->appendChild($node);
        }
        $node->nodeValue = htmlspecialchars($subject);
    }
1021873
def with_subject(self, subject):
        
        return self.__class__(
            self._signer,
            service_account_email=self._service_account_email,
            scopes=self._scopes,
            token_uri=self._token_uri,
            subject=subject,
            project_id=self._project_id,
            additional_claims=self._additional_claims.copy())
467807
def set_topic(self, channel_name, topic):
        
        channel_id = self.get_channel_id(channel_name)
        self.params.update({
            'channel': channel_id,
            'topic': topic,
            })
        return FromUrl('https://slack.com/api/channels.setTopic', self._requests)(data=self.params).post()
603587
def add_assignment(self, value):
        """"""
        if not value in self._assignments:
            self._assignments.append(value)
1336636
def add_subject(self, ind_id, sex=None, phenotype=None):
        

        self.pedigree_data[ind_id] = len(self.phenotype_data[0])
        if phenotype != None:
            if type(self.phenotype_data) is list:
                self.phenotype_data[0].append(phenotype)
            else:
                self.phenotype_data[-1, len(self.individual_mask)] = phenotype
        self.individual_mask.append(0)

        if PhenoCovar.sex_as_covariate:
            try:
                self.covariate_data[0].append(float(sex))
            except Exception, e:
                raise MalformedInputFile("Invalid setting, %s, for sex in pedigree" % (sex))
1011529
public void setTopicIds(String v) {
    if (Token_Type.featOkTst && ((Token_Type)jcasType).casFeat_topicIds == null)
      jcasType.jcas.throwFeatMissing("topicIds", "de.julielab.jules.types.Token");
    jcasType.ll_cas.ll_setStringValue(addr, ((Token_Type)jcasType).casFeatCode_topicIds, v);}
825931
public function setSubject($subject)
	{
		self::validateSubject($subject, true);

		$this->model_class = $subject->className();
		$this->foreign_pk = $subject->getPrimaryKey(true);
		$this->subject = $subject;
	}
297423
def assign_to_topic_partition(self, topic_partition=None):
        

        if isinstance(topic_partition, TopicPartition):
            topic_partition = [topic_partition]
        if not self._is_assigned(topic_partition):
            self.consumer.assign(topic_partition)
950956
def _set_subject(self, subject):
        
        # if not subject:
        #     self.subject =
        def test_uri(value):
            """ test to see if the value is a uri or bnode

            Returns: Uri or Bnode """
            # .__wrapped__
            if not isinstance(value, (Uri, BlankNode)):
                try:
                    if value.startswith("_:"):
                        return BlankNode(value)
                    else:
                        return Uri(value)
                except:
                    return BlankNode()
            else:
                return value

        if isinstance(subject, dict):
            self.subject = test_uri(subject['s'])
            if isinstance(subject['o'], list):
                for item in subject['o']:
                    self.add_property(subject['p'],
                                      item)
            else:
                self.add_property(subject['p'],
                                  subject['o'])
        else:
            self.subject = test_uri(subject)
911191
public void assign(Iterable<?> source) {
        clear();
        int i = 0;
        
        for (Object value : source) {
            values.put(Integer.toString(++i), value);
        }
    }
1137856
function TopicPartition(topic, partition, offset) {
  if (!(this instanceof TopicPartition)) {
    return new TopicPartition(topic, partition, offset);
  }

  // Validate that the elements we are iterating over are actual topic partition
  // js objects. They do not need an offset, but they do need partition
  if (!topic) {
    throw new TypeError('"topic" must be a string and must be set');
  }

  if (partition === null || partition === undefined) {
    throw new TypeError('"partition" must be a number and must set');
  }

  // We can just set topic and partition as they stand.
  this.topic = topic;
  this.partition = partition;

  if (offset === undefined || offset === null) {
    this.offset = Topic.OFFSET_STORED;
  } else if (typeof offset === 'string') {
    switch (offset.toLowerCase()) {
      case 'earliest':
      case 'beginning':
        this.offset = Topic.OFFSET_BEGINNING;
        break;
      case 'latest':
      case 'end':
        this.offset = Topic.OFFSET_END;
        break;
      case 'stored':
        this.offset = Topic.OFFSET_STORED;
        break;
      default:
        throw new TypeError('"offset", if provided as a string, must be beginning, end, or stored.');
    }
  } else if (typeof offset === 'number') {
    this.offset = offset;
  } else {
    throw new TypeError('"offset" must be a special string or number if it is set');
  }
}
189715
def empty_topic(self, topic):
        """"""
        nsq.assert_valid_topic_name(topic)
        return self._request('POST', '/topic/empty', fields={'topic': topic})
991249
public <T> void register(String subjectName,
                                   SubjectObserver<T> subjectObserver,
                                   Subject<T> subject)
   {
      subject.add(subjectObserver);
      
      this.registry.put(subjectName, subject);
   }