PUT /topics/1
 PUT /topics/1.xml
517385
def update
      @topic = Topic.find(params[:id])

      if @topic.update_attributes(topic_params)
        redirect_to(topic_path(@topic.id), notice: t('homeland.topic_updated'))
      else
        render action: "edit"
      end
    end
1001014
def topic(self, channel, topic=None):
        """"""
        if topic:
            channel += ' :' + topic
        self.send_line('TOPIC %s' % channel)
1231701
def assign(members:, topics:)
      group_assignment = {}

      members.each do |member_id|
        group_assignment[member_id] = Protocol::MemberAssignment.new
      end

      topic_partitions = topics.flat_map do |topic|
        begin
          partitions = @cluster.partitions_for(topic).map(&:partition_id)
        rescue UnknownTopicOrPartition
          raise UnknownTopicOrPartition, "unknown topic #{topic}"
        end
        Array.new(partitions.count) { topic }.zip(partitions)
      end

      partitions_per_member = topic_partitions.group_by.with_index do |_, index|
        index % members.count
      end.values

      members.zip(partitions_per_member).each do |member_id, member_partitions|
        unless member_partitions.nil?
          member_partitions.each do |topic, partition|
            group_assignment[member_id].assign(topic, [partition])
          end
        end
      end

      group_assignment
    rescue Kafka::LeaderNotAvailable
      sleep 1
      retry
    end
899243
def rewrite_subject_group(root, subjects, subject_group_type, overwrite=True):
    ""
    parent_tag_name = 'subj-group'
    tag_name = 'subject'
    wrap_tag_name = 'article-categories'
    tag_attribute = 'subj-group-type'
    # the parent tag where it should be found
    xpath_parent = './/front/article-meta/article-categories'
    # the wraping tag in case article-categories does not exist
    xpath_article_meta = './/front/article-meta'
    # the xpath to find the subject tags we are interested in
    xpath = './/{parent_tag_name}[@{tag_attribute}="{group_type}"]'.format(
        parent_tag_name=parent_tag_name,
        tag_attribute=tag_attribute,
        group_type=subject_group_type)

    count = 0
    # get the parent tag
    parent_tag = root.find(xpath_parent)
    if parent_tag is None:
        # parent tag not found, add one
        wrap_tag = root.find(xpath_article_meta)
        article_categories_tag = SubElement(wrap_tag, wrap_tag_name)
        parent_tag = article_categories_tag
    insert_index = 0
    # iterate all tags to find the index of the first tag we are interested in
    if parent_tag is not None:
        for tag_index, tag in enumerate(parent_tag.findall('*')):
            if tag.tag == parent_tag_name and tag.get(tag_attribute) == subject_group_type:
                insert_index = tag_index
                if overwrite is True:
                    # if overwriting use the first one found
                    break
            # if not overwriting, use the last one found + 1
            if overwrite is not True:
                insert_index += 1
    # remove the tag if overwriting the existing values
    if overwrite is True:
        # remove all the tags
        for tag in root.findall(xpath):
            parent_tag.remove(tag)
    # add the subjects
    for subject in subjects:
        subj_group_tag = Element(parent_tag_name)
        subj_group_tag.set(tag_attribute, subject_group_type)
        subject_tag = SubElement(subj_group_tag, tag_name)
        subject_tag.text = subject
        parent_tag.insert(insert_index, subj_group_tag)
        count += 1
        insert_index += 1
    return count
849169
def reorder_pinned_topics_groups(self, order, group_id):
        
        path = {}
        data = {}
        params = {}

        # REQUIRED - PATH - group_id
        """ID"""
        path["group_id"] = group_id

        # REQUIRED - order
        """The ids of the pinned discussion topics in the desired order.
        (For example, "order=104,102,103".)"""
        data["order"] = order

        self.logger.debug("POST /api/v1/groups/{group_id}/discussion_topics/reorder with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("POST", "/api/v1/groups/{group_id}/discussion_topics/reorder".format(**path), data=data, params=params, no_data=True)
317111
def place_in_layouts(content, payload, info)
      output = content.dup
      layout = layouts[document.data["layout"]]

      Bunto.logger.warn(
        "Build Warning:",
        "Layout '#{document.data["layout"]}' requested in "\
        "#{document.relative_path} does not exist."
      ) if invalid_layout? layout

      used = Set.new([layout])

      # Reset the payload layout data to ensure it starts fresh for each page.
      payload["layout"] = nil

      while layout
        payload["content"] = output
        payload["layout"]  = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})

        output = render_liquid(
          layout.content,
          payload,
          info,
          layout.relative_path
        )

        # Add layout to dependency tree
        site.regenerator.add_dependency(
          site.in_source_dir(document.path),
          site.in_source_dir(layout.path)
        ) if document.write?

        if (layout = layouts[layout.data["layout"]])
          break if used.include?(layout)
          used << layout
        end
      end

      output
    end
1294783
def topic(self, channel, new_topic=None, tags=None):
        """"""
        params = [channel]
        if new_topic:
            params += new_topic
        self.send('TOPIC', params=params, source=self.nick, tags=tags)
310552
public void setTopic(String topic)
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "setTopic", topic);

    this.topic = topic;

    if (tc.isEntryEnabled())
      SibTr.exit(tc, "setTopic");
  }
751832
def topics(preload: Kazoo::Topic::DEFAULT_PRELOAD_METHODS)
      @topics_mutex.synchronize do
        @topics ||= begin
          topics = zk.get_children(path: "/brokers/topics")
          raise Kazoo::Error, "Failed to list topics. Error code: #{topics.fetch(:rc)}" unless topics.fetch(:rc) == Zookeeper::Constants::ZOK
          preload_topics_from_names(topics.fetch(:children), preload: preload)
        end
      end
    end
363079
def update_from(other)
      @topic = other.topic
      @name = other.name
      @position = other.position
      @topic = other.topic
      @recipients = other.recipients
      @bitrate = other.bitrate
      @user_limit = other.user_limit
      @permission_overwrites = other.permission_overwrites
      @nsfw = other.nsfw
      @parent_id = other.parent_id
      @rate_limit_per_user = other.rate_limit_per_user
    end
260607
def put(self, url):
        """"""
        response = self.http_request(url, 'PUT', self, {'Content-Type': 'application/xml; charset=utf-8'})
        if response.status != 200:
            self.raise_http_error(response)

        response_xml = response.read()
        logging.getLogger('recurly.http.response').debug(response_xml)
        self.update_from_element(ElementTree.fromstring(response_xml))
797838
def set_topic(topic)
      room.update("topic" => topic) do
        room.topic = topic
        client.numeric_reply :rpl_topic, channel, ':' + room.topic
      end
    end
955677
private void populateTopics(String[] topics) {
        for (String t : topics) {
            // Clean up leading and trailing white space as appropriate
            t = t.trim();

            // Ignore topics that start or end with a '/'
            if (t.startsWith("/") || t.endsWith("/") || t.contains("//") || t.isEmpty()) {
                continue;
            }

            // Validate subscribe permission per section 113.10.2
            checkTopicSubscribePermission(t);

            if (t.equals("*")) {
                wildcardTopics.add("");
            } else if (t.endsWith("/*")) {
                wildcardTopics.add(t.substring(0, t.length() - 1));
            } else {
                discreteTopics.add(t);
            }
        }
    }
1028255
function isAncestorTopic (topic, node) {
    var nodeTopic = getTopic(node);

    return topic === nodeTopic
      || startsWith(topic, nodeTopic + '.')
      || nodeTopic === '';
  }
591265
def put(path, data, options = {})
      uri = build_uri(path, options)

      request = Net::HTTP::Put.new(uri.request_uri)
      set_authorisation_header(request)
      request.set_form_data(data)

      response = https_client(uri).request(request)
    end
1286192
function(params, cb) {
    cb = cb || _noop;
    assert(params.topic);

    _metaBroker.metadata([params.topic], function(err, cluster) {
      cluster.topics.forEach(function(topic) {
        _partitions[topic.topicName] = topic.partitions;
      });

      cb(err, cluster);
    });
  }
1235789
def topic_path(cls, project, topic):
        """"""
        return google.api_core.path_template.expand(
            "projects/{project}/topics/{topic}", project=project, topic=topic
        )