text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/edgecontainer/v1/service.proto

package com.google.cloud.edgecontainer.v1;

/**
 *
 *
 *

 * Updates a cluster.
 *

 *
 * Protobuf type {@code google.cloud.edgecontainer.v1.UpdateClusterRequest}
 */
public final class UpdateClusterRequest extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.edgecontainer.v1.UpdateClusterRequest)
    UpdateClusterRequestOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use UpdateClusterRequest.newBuilder() to construct.
  private UpdateClusterRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private UpdateClusterRequest() {
    requestId_ = "";
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
    return new UpdateClusterRequest();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
    return this.unknownFields;
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.cloud.edgecontainer.v1.ServiceProto
        .internal_static_google_cloud_edgecontainer_v1_UpdateClusterRequest_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.edgecontainer.v1.ServiceProto
        .internal_static_google_cloud_edgecontainer_v1_UpdateClusterRequest_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.edgecontainer.v1.UpdateClusterRequest.class,
            com.google.cloud.edgecontainer.v1.UpdateClusterRequest.Builder.class);
  }

  public static final int UPDATE_MASK_FIELD_NUMBER = 1;
  private com.google.protobuf.FieldMask updateMask_;
  /**
   *
   *
   *

   * Field mask is used to specify the fields to be overwritten in the
   * Cluster resource by the update.
   * The fields specified in the update_mask are relative to the resource, not
   * the full request. A field will be overwritten if it is in the mask. If the
   * user does not provide a mask then all fields will be overwritten.
   *

   *
   * .google.protobuf.FieldMask update_mask = 1;
   *
   * @return Whether the updateMask field is set.
   */
  @java.lang.Override
  public boolean hasUpdateMask() {
    return updateMask_ != null;
  }
  /**
   *
   *
   *

   * Field mask is used to specify the fields to be overwritten in the
   * Cluster resource by the update.
   * The fields specified in the update_mask are relative to the resource, not
   * the full request. A field will be overwritten if it is in the mask. If the
   * user does not provide a mask then all fields will be overwritten.
   *

   *
   * .google.protobuf.FieldMask update_mask = 1;
   *
   * @return The updateMask.
   */
  @java.lang.Override
  public com.google.protobuf.FieldMask getUpdateMask() {
    return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_;
  }
  /**
   *
   *
   *

   * Field mask is used to specify the fields to be overwritten in the
   * Cluster resource by the update.
   * The fields specified in the update_mask are relative to the resource, not
   * the full request. A field will be overwritten if it is in the mask. If the
   * user does not provide a mask then all fields will be overwritten.
   *

   *
   * .google.protobuf.FieldMask update_mask = 1;
   */
  @java.lang.Override
  public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() {
    return getUpdateMask();
  }

  public static final int CLUSTER_FIELD_NUMBER = 2;
  private com.google.cloud.edgecontainer.v1.Cluster cluster_;
  /**
   *
   *
   *

   * The updated cluster.
   *

   *
   * .google.cloud.edgecontainer.v1.Cluster cluster = 2;
   *
   * @return Whether the cluster field is set.
   */
  @java.lang.Override
  public boolean hasCluster() {
    return cluster_ != null;
  }
  /**
   *
   *
   *

   * The updated cluster.
   *

   *
   * .google.cloud.edgecontainer.v1.Cluster cluster = 2;
   *
   * @return The cluster.
   */
  @java.lang.Override
  public com.google.cloud.edgecontainer.v1.Cluster getCluster() {
    return cluster_ == null
        ? com.google.cloud.edgecontainer.v1.Cluster.getDefaultInstance()
        : cluster_;
  }
  /**
   *
   *
   *

   * The updated cluster.
   *

   *
   * .google.cloud.edgecontainer.v1.Cluster cluster = 2;
   */
  @java.lang.Override
  public com.google.cloud.edgecontainer.v1.ClusterOrBuilder getClusterOrBuilder() {
    return getCluster();
  }

  public static final int REQUEST_ID_FIELD_NUMBER = 3;
  private volatile java.lang.Object requestId_;
  /**
   *
   *
   *

   * A unique identifier for this request. Restricted to 36 ASCII characters.
   * A random UUID is recommended.
   * This request is only idempotent if `request_id` is provided.
   *

   *
   * string request_id = 3;
   *
   * @return The requestId.
   */
  @java.lang.Override
  public java.lang.String getRequestId() {
    java.lang.Object ref = requestId_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      requestId_ = s;
      return s;
    }
  }
  /**
   *
   *
   *

   * A unique identifier for this request. Restricted to 36 ASCII characters.
   * A random UUID is recommended.
   * This request is only idempotent if `request_id` is provided.
   *

   *
   * string request_id = 3;
   *
   * @return The bytes for requestId.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getRequestIdBytes() {
    java.lang.Object ref = requestId_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      requestId_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  private byte memoizedIsInitialized = -1;

  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    if (updateMask_ != null) {
      output.writeMessage(1, getUpdateMask());
    }
    if (cluster_ != null) {
      output.writeMessage(2, getCluster());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(requestId_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 3, requestId_);
    }
    getUnknownFields().writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (updateMask_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getUpdateMask());
    }
    if (cluster_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getCluster());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(requestId_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, requestId_);
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof com.google.cloud.edgecontainer.v1.UpdateClusterRequest)) {
      return super.equals(obj);
    }
    com.google.cloud.edgecontainer.v1.UpdateClusterRequest other =
        (com.google.cloud.edgecontainer.v1.UpdateClusterRequest) obj;

    if (hasUpdateMask() != other.hasUpdateMask()) return false;
    if (hasUpdateMask()) {
      if (!getUpdateMask().equals(other.getUpdateMask())) return false;
    }
    if (hasCluster() != other.hasCluster()) return false;
    if (hasCluster()) {
      if (!getCluster().equals(other.getCluster())) return false;
    }
    if (!getRequestId().equals(other.getRequestId())) return false;
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    if (hasUpdateMask()) {
      hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER;
      hash = (53 * hash) + getUpdateMask().hashCode();
    }
    if (hasCluster()) {
      hash = (37 * hash) + CLUSTER_FIELD_NUMBER;
      hash = (53 * hash) + getCluster().hashCode();
    }
    hash = (37 * hash) + REQUEST_ID_FIELD_NUMBER;
    hash = (53 * hash) + getRequestId().hashCode();
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.edgecontainer.v1.UpdateClusterRequest parseFrom(
      java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.edgecontainer.v1.UpdateClusterRequest parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.edgecontainer.v1.UpdateClusterRequest parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.edgecontainer.v1.UpdateClusterRequest parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.edgecontainer.v1.UpdateClusterRequest parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.edgecontainer.v1.UpdateClusterRequest parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.edgecontainer.v1.UpdateClusterRequest parseFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.edgecontainer.v1.UpdateClusterRequest parseFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.cloud.edgecontainer.v1.UpdateClusterRequest parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.cloud.edgecontainer.v1.UpdateClusterRequest parseDelimitedFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.cloud.edgecontainer.v1.UpdateClusterRequest parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.edgecontainer.v1.UpdateClusterRequest parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() {
    return newBuilder();
  }

  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }

  public static Builder newBuilder(
      com.google.cloud.edgecontainer.v1.UpdateClusterRequest prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }

  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   *
   *
   *

   * Updates a cluster.
   *

   *
   * Protobuf type {@code google.cloud.edgecontainer.v1.UpdateClusterRequest}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.edgecontainer.v1.UpdateClusterRequest)
      com.google.cloud.edgecontainer.v1.UpdateClusterRequestOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.edgecontainer.v1.ServiceProto
          .internal_static_google_cloud_edgecontainer_v1_UpdateClusterRequest_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.edgecontainer.v1.ServiceProto
          .internal_static_google_cloud_edgecontainer_v1_UpdateClusterRequest_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.edgecontainer.v1.UpdateClusterRequest.class,
              com.google.cloud.edgecontainer.v1.UpdateClusterRequest.Builder.class);
    }

    // Construct using com.google.cloud.edgecontainer.v1.UpdateClusterRequest.newBuilder()
    private Builder() {}

    private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      if (updateMaskBuilder_ == null) {
        updateMask_ = null;
      } else {
        updateMask_ = null;
        updateMaskBuilder_ = null;
      }
      if (clusterBuilder_ == null) {
        cluster_ = null;
      } else {
        cluster_ = null;
        clusterBuilder_ = null;
      }
      requestId_ = "";

      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.edgecontainer.v1.ServiceProto
          .internal_static_google_cloud_edgecontainer_v1_UpdateClusterRequest_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.edgecontainer.v1.UpdateClusterRequest getDefaultInstanceForType() {
      return com.google.cloud.edgecontainer.v1.UpdateClusterRequest.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.cloud.edgecontainer.v1.UpdateClusterRequest build() {
      com.google.cloud.edgecontainer.v1.UpdateClusterRequest result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.cloud.edgecontainer.v1.UpdateClusterRequest buildPartial() {
      com.google.cloud.edgecontainer.v1.UpdateClusterRequest result =
          new com.google.cloud.edgecontainer.v1.UpdateClusterRequest(this);
      if (updateMaskBuilder_ == null) {
        result.updateMask_ = updateMask_;
      } else {
        result.updateMask_ = updateMaskBuilder_.build();
      }
      if (clusterBuilder_ == null) {
        result.cluster_ = cluster_;
      } else {
        result.cluster_ = clusterBuilder_.build();
      }
      result.requestId_ = requestId_;
      onBuilt();
      return result;
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }

    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.setField(field, value);
    }

    @java.lang.Override
    public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }

    @java.lang.Override
    public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }

    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }

    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.cloud.edgecontainer.v1.UpdateClusterRequest) {
        return mergeFrom((com.google.cloud.edgecontainer.v1.UpdateClusterRequest) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.edgecontainer.v1.UpdateClusterRequest other) {
      if (other == com.google.cloud.edgecontainer.v1.UpdateClusterRequest.getDefaultInstance())
        return this;
      if (other.hasUpdateMask()) {
        mergeUpdateMask(other.getUpdateMask());
      }
      if (other.hasCluster()) {
        mergeCluster(other.getCluster());
      }
      if (!other.getRequestId().isEmpty()) {
        requestId_ = other.requestId_;
        onChanged();
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 10:
              {
                input.readMessage(getUpdateMaskFieldBuilder().getBuilder(), extensionRegistry);

                break;
              } // case 10
            case 18:
              {
                input.readMessage(getClusterFieldBuilder().getBuilder(), extensionRegistry);

                break;
              } // case 18
            case 26:
              {
                requestId_ = input.readStringRequireUtf8();

                break;
              } // case 26
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

    private com.google.protobuf.FieldMask updateMask_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.FieldMask,
            com.google.protobuf.FieldMask.Builder,
            com.google.protobuf.FieldMaskOrBuilder>
        updateMaskBuilder_;
    /**
     *
     *
     *

     * Field mask is used to specify the fields to be overwritten in the
     * Cluster resource by the update.
     * The fields specified in the update_mask are relative to the resource, not
     * the full request. A field will be overwritten if it is in the mask. If the
     * user does not provide a mask then all fields will be overwritten.
     *

     *
     * .google.protobuf.FieldMask update_mask = 1;
     *
     * @return Whether the updateMask field is set.
     */
    public boolean hasUpdateMask() {
      return updateMaskBuilder_ != null || updateMask_ != null;
    }
    /**
     *
     *
     *

     * Field mask is used to specify the fields to be overwritten in the
     * Cluster resource by the update.
     * The fields specified in the update_mask are relative to the resource, not
     * the full request. A field will be overwritten if it is in the mask. If the
     * user does not provide a mask then all fields will be overwritten.
     *

     *
     * .google.protobuf.FieldMask update_mask = 1;
     *
     * @return The updateMask.
     */
    public com.google.protobuf.FieldMask getUpdateMask() {
      if (updateMaskBuilder_ == null) {
        return updateMask_ == null
            ? com.google.protobuf.FieldMask.getDefaultInstance()
            : updateMask_;
      } else {
        return updateMaskBuilder_.getMessage();
      }
    }
    /**
     *
     *
     *

     * Field mask is used to specify the fields to be overwritten in the
     * Cluster resource by the update.
     * The fields specified in the update_mask are relative to the resource, not
     * the full request. A field will be overwritten if it is in the mask. If the
     * user does not provide a mask then all fields will be overwritten.
     *

     *
     * .google.protobuf.FieldMask update_mask = 1;
     */
    public Builder setUpdateMask(com.google.protobuf.FieldMask value) {
      if (updateMaskBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        updateMask_ = value;
        onChanged();
      } else {
        updateMaskBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     *

     * Field mask is used to specify the fields to be overwritten in the
     * Cluster resource by the update.
     * The fields specified in the update_mask are relative to the resource, not
     * the full request. A field will be overwritten if it is in the mask. If the
     * user does not provide a mask then all fields will be overwritten.
     *

     *
     * .google.protobuf.FieldMask update_mask = 1;
     */
    public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) {
      if (updateMaskBuilder_ == null) {
        updateMask_ = builderForValue.build();
        onChanged();
      } else {
        updateMaskBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     *

     * Field mask is used to specify the fields to be overwritten in the
     * Cluster resource by the update.
     * The fields specified in the update_mask are relative to the resource, not
     * the full request. A field will be overwritten if it is in the mask. If the
     * user does not provide a mask then all fields will be overwritten.
     *

     *
     * .google.protobuf.FieldMask update_mask = 1;
     */
    public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) {
      if (updateMaskBuilder_ == null) {
        if (updateMask_ != null) {
          updateMask_ =
              com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial();
        } else {
          updateMask_ = value;
        }
        onChanged();
      } else {
        updateMaskBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     *

     * Field mask is used to specify the fields to be overwritten in the
     * Cluster resource by the update.
     * The fields specified in the update_mask are relative to the resource, not
     * the full request. A field will be overwritten if it is in the mask. If the
     * user does not provide a mask then all fields will be overwritten.
     *

     *
     * .google.protobuf.FieldMask update_mask = 1;
     */
    public Builder clearUpdateMask() {
      if (updateMaskBuilder_ == null) {
        updateMask_ = null;
        onChanged();
      } else {
        updateMask_ = null;
        updateMaskBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     *

     * Field mask is used to specify the fields to be overwritten in the
     * Cluster resource by the update.
     * The fields specified in the update_mask are relative to the resource, not
     * the full request. A field will be overwritten if it is in the mask. If the
     * user does not provide a mask then all fields will be overwritten.
     *

     *
     * .google.protobuf.FieldMask update_mask = 1;
     */
    public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() {

      onChanged();
      return getUpdateMaskFieldBuilder().getBuilder();
    }
    /**
     *
     *
     *

     * Field mask is used to specify the fields to be overwritten in the
     * Cluster resource by the update.
     * The fields specified in the update_mask are relative to the resource, not
     * the full request. A field will be overwritten if it is in the mask. If the
     * user does not provide a mask then all fields will be overwritten.
     *

     *
     * .google.protobuf.FieldMask update_mask = 1;
     */
    public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() {
      if (updateMaskBuilder_ != null) {
        return updateMaskBuilder_.getMessageOrBuilder();
      } else {
        return updateMask_ == null
            ? com.google.protobuf.FieldMask.getDefaultInstance()
            : updateMask_;
      }
    }
    /**
     *
     *
     *

     * Field mask is used to specify the fields to be overwritten in the
     * Cluster resource by the update.
     * The fields specified in the update_mask are relative to the resource, not
     * the full request. A field will be overwritten if it is in the mask. If the
     * user does not provide a mask then all fields will be overwritten.
     *

     *
     * .google.protobuf.FieldMask update_mask = 1;
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.FieldMask,
            com.google.protobuf.FieldMask.Builder,
            com.google.protobuf.FieldMaskOrBuilder>
        getUpdateMaskFieldBuilder() {
      if (updateMaskBuilder_ == null) {
        updateMaskBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.FieldMask,
                com.google.protobuf.FieldMask.Builder,
                com.google.protobuf.FieldMaskOrBuilder>(
                getUpdateMask(), getParentForChildren(), isClean());
        updateMask_ = null;
      }
      return updateMaskBuilder_;
    }

    private com.google.cloud.edgecontainer.v1.Cluster cluster_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.edgecontainer.v1.Cluster,
            com.google.cloud.edgecontainer.v1.Cluster.Builder,
            com.google.cloud.edgecontainer.v1.ClusterOrBuilder>
        clusterBuilder_;
    /**
     *
     *
     *

     * The updated cluster.
     *

     *
     * .google.cloud.edgecontainer.v1.Cluster cluster = 2;
     *
     * @return Whether the cluster field is set.
     */
    public boolean hasCluster() {
      return clusterBuilder_ != null || cluster_ != null;
    }
    /**
     *
     *
     *

     * The updated cluster.
     *

     *
     * .google.cloud.edgecontainer.v1.Cluster cluster = 2;
     *
     * @return The cluster.
     */
    public com.google.cloud.edgecontainer.v1.Cluster getCluster() {
      if (clusterBuilder_ == null) {
        return cluster_ == null
            ? com.google.cloud.edgecontainer.v1.Cluster.getDefaultInstance()
            : cluster_;
      } else {
        return clusterBuilder_.getMessage();
      }
    }
    /**
     *
     *
     *

     * The updated cluster.
     *

     *
     * .google.cloud.edgecontainer.v1.Cluster cluster = 2;
     */
    public Builder setCluster(com.google.cloud.edgecontainer.v1.Cluster value) {
      if (clusterBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        cluster_ = value;
        onChanged();
      } else {
        clusterBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     *

     * The updated cluster.
     *

     *
     * .google.cloud.edgecontainer.v1.Cluster cluster = 2;
     */
    public Builder setCluster(com.google.cloud.edgecontainer.v1.Cluster.Builder builderForValue) {
      if (clusterBuilder_ == null) {
        cluster_ = builderForValue.build();
        onChanged();
      } else {
        clusterBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     *

     * The updated cluster.
     *

     *
     * .google.cloud.edgecontainer.v1.Cluster cluster = 2;
     */
    public Builder mergeCluster(com.google.cloud.edgecontainer.v1.Cluster value) {
      if (clusterBuilder_ == null) {
        if (cluster_ != null) {
          cluster_ =
              com.google.cloud.edgecontainer.v1.Cluster.newBuilder(cluster_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          cluster_ = value;
        }
        onChanged();
      } else {
        clusterBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     *

     * The updated cluster.
     *

     *
     * .google.cloud.edgecontainer.v1.Cluster cluster = 2;
     */
    public Builder clearCluster() {
      if (clusterBuilder_ == null) {
        cluster_ = null;
        onChanged();
      } else {
        cluster_ = null;
        clusterBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     *

     * The updated cluster.
     *

     *
     * .google.cloud.edgecontainer.v1.Cluster cluster = 2;
     */
    public com.google.cloud.edgecontainer.v1.Cluster.Builder getClusterBuilder() {

      onChanged();
      return getClusterFieldBuilder().getBuilder();
    }
    /**
     *
     *
     *

     * The updated cluster.
     *

     *
     * .google.cloud.edgecontainer.v1.Cluster cluster = 2;
     */
    public com.google.cloud.edgecontainer.v1.ClusterOrBuilder getClusterOrBuilder() {
      if (clusterBuilder_ != null) {
        return clusterBuilder_.getMessageOrBuilder();
      } else {
        return cluster_ == null
            ? com.google.cloud.edgecontainer.v1.Cluster.getDefaultInstance()
            : cluster_;
      }
    }
    /**
     *
     *
     *

     * The updated cluster.
     *

     *
     * .google.cloud.edgecontainer.v1.Cluster cluster = 2;
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.edgecontainer.v1.Cluster,
            com.google.cloud.edgecontainer.v1.Cluster.Builder,
            com.google.cloud.edgecontainer.v1.ClusterOrBuilder>
        getClusterFieldBuilder() {
      if (clusterBuilder_ == null) {
        clusterBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.edgecontainer.v1.Cluster,
                com.google.cloud.edgecontainer.v1.Cluster.Builder,
                com.google.cloud.edgecontainer.v1.ClusterOrBuilder>(
                getCluster(), getParentForChildren(), isClean());
        cluster_ = null;
      }
      return clusterBuilder_;
    }

    private java.lang.Object requestId_ = "";
    /**
     *
     *
     *

     * A unique identifier for this request. Restricted to 36 ASCII characters.
     * A random UUID is recommended.
     * This request is only idempotent if `request_id` is provided.
     *

     *
     * string request_id = 3;
     *
     * @return The requestId.
     */
    public java.lang.String getRequestId() {
      java.lang.Object ref = requestId_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        requestId_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     *

     * A unique identifier for this request. Restricted to 36 ASCII characters.
     * A random UUID is recommended.
     * This request is only idempotent if `request_id` is provided.
     *

     *
     * string request_id = 3;
     *
     * @return The bytes for requestId.
     */
    public com.google.protobuf.ByteString getRequestIdBytes() {
      java.lang.Object ref = requestId_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        requestId_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     *

     * A unique identifier for this request. Restricted to 36 ASCII characters.
     * A random UUID is recommended.
     * This request is only idempotent if `request_id` is provided.
     *

     *
     * string request_id = 3;
     *
     * @param value The requestId to set.
     * @return This builder for chaining.
     */
    public Builder setRequestId(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      requestId_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     *

     * A unique identifier for this request. Restricted to 36 ASCII characters.
     * A random UUID is recommended.
     * This request is only idempotent if `request_id` is provided.
     *

     *
     * string request_id = 3;
     *
     * @return This builder for chaining.
     */
    public Builder clearRequestId() {

      requestId_ = getDefaultInstance().getRequestId();
      onChanged();
      return this;
    }
    /**
     *
     *
     *

     * A unique identifier for this request. Restricted to 36 ASCII characters.
     * A random UUID is recommended.
     * This request is only idempotent if `request_id` is provided.
     *

     *
     * string request_id = 3;
     *
     * @param value The bytes for requestId to set.
     * @return This builder for chaining.
     */
    public Builder setRequestIdBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

      requestId_ = value;
      onChanged();
      return this;
    }

    @java.lang.Override
    public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }

    // @@protoc_insertion_point(builder_scope:google.cloud.edgecontainer.v1.UpdateClusterRequest)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.edgecontainer.v1.UpdateClusterRequest)
  private static final com.google.cloud.edgecontainer.v1.UpdateClusterRequest DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.edgecontainer.v1.UpdateClusterRequest();
  }

  public static com.google.cloud.edgecontainer.v1.UpdateClusterRequest getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<UpdateClusterRequest> PARSER =
      new com.google.protobuf.AbstractParser<UpdateClusterRequest>() {
        @java.lang.Override
        public UpdateClusterRequest parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          Builder builder = newBuilder();
          try {
            builder.mergeFrom(input, extensionRegistry);
          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
            throw e.setUnfinishedMessage(builder.buildPartial());
          } catch (com.google.protobuf.UninitializedMessageException e) {
            throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
          } catch (java.io.IOException e) {
            throw new com.google.protobuf.InvalidProtocolBufferException(e)
                .setUnfinishedMessage(builder.buildPartial());
          }
          return builder.buildPartial();
        }
      };

  public static com.google.protobuf.Parser<UpdateClusterRequest> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<UpdateClusterRequest> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.cloud.edgecontainer.v1.UpdateClusterRequest getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}


text:
        <fieldset class="closeable advanced-search">

Title
              <input type="text" autocomplete="off" onkeyup="" value="" class="input_text search" size="45" id="search_title" name="search_title">

Creation dateselect range

              <input type="text" autocomplete="off" onkeyup="" value="" class="input_text date" size="45" id="date_from" name="date_from"><input type="text" autocomplete="off" onkeyup="" value="" class="input_text right-floated date" size="45" id="date_to" name="date_to">

Duration
              <select onchange="" class="input_select" id="duration" name="duration">
                  <option selected="selected" value="1">all durations</option>
                  <option value="2">short</option>
                  <option value="3">medium</option>
                  <option value="4">long</option>
              </select>

Tags / Genres
              <input type="text" autocomplete="off" onkeyup="" value="" class="input_text" size="45" id="tags_genres" name="tags_genres">

Track/set type
              <select onchange="" class="input_select" id="type" name="type">
                  <option selected="selected" value="">Select type</option>
                  <option value="1">Type 1</option>
                  <option value="2">Type 2</option>
                  <option value="3">Type 3</option>
              </select>

Creator
              <input type="text" autocomplete="off" onkeyup="" value="" class="input_text" size="45" id="creator" name="creator">

Licence
            <select onchange="" class="input_select" id="licence" name="licence">
                  <option selected="selected" value="">Select licence type</option>
                  <option value="1">Type 1</option>
                  <option value="2">Type 2</option>
                  <option value="3">Type 3</option>
              </select>

          <input type="button" name="advanced-search" id="advanced-search" value="Search" class="save-button-small right-floated" onclick="">

        </fieldset>

            Advanced search

redpajama_set_name: RedPajamaGithub


text:
@protocol CRWWebViewScrollViewProxyObserver;

namespace web {
class WebState;
}  // namespace web

// Handles logging of Breadcrumb events associated with `web_state_`.
class BreadcrumbManagerTabHelper
    : public breadcrumbs::BreadcrumbManagerTabHelper,
      public web::WebStateObserver,
      public web::WebStateUserData<BreadcrumbManagerTabHelper> {
 public:
  ~BreadcrumbManagerTabHelper() override;
  BreadcrumbManagerTabHelper(const BreadcrumbManagerTabHelper&) = delete;
  BreadcrumbManagerTabHelper& operator=(const BreadcrumbManagerTabHelper&) =
      delete;

 private:
  friend class web::WebStateUserData<BreadcrumbManagerTabHelper>;

  explicit BreadcrumbManagerTabHelper(web::WebState* web_state);

  // breadcrumbs::BreadcrumbManagerTabHelper:
  void PlatformLogEvent(const std::string& event) override;

  // web::WebStateObserver:
  void DidStartNavigation(web::WebState* web_state,
                          web::NavigationContext* navigation_context) override;
  void DidFinishNavigation(web::WebState* web_state,
                           web::NavigationContext* navigation_context) override;
  void PageLoaded(
      web::WebState* web_state,
      web::PageLoadCompletionStatus load_completion_status) override;
  void DidChangeVisibleSecurityState(web::WebState* web_state) override;
  void RenderProcessGone(web::WebState* web_state) override;
  void WebStateDestroyed(web::WebState* web_state) override;

  // The webstate associated with this tab helper.
  web::WebState* web_state_ = nullptr;

  // A counter which is incremented for each scroll event. This value is reset
  // when any other event is logged.
  int sequentially_scrolled_ = 0;

  // Allows observing Objective-C object for Scroll and Zoom events.
  __strong id<CRWWebViewScrollViewProxyObserver> scroll_observer_;

  WEB_STATE_USER_DATA_KEY_DECL();
};

#endif  // IOS_CHROME_BROWSER_CRASH_REPORT_BREADCRUMBS_BREADCRUMB_MANAGER_TAB_HELPER_H_


text:
<?php

/**
 * @category   Spark
 * @package    Spark_Event
 * @copyright  Copyright (c) 2010 Christoph Hochstrasser
 * @license    MIT License
 */
class Spark_Event_Dispatcher implements Spark_Event_DispatcherInterface
{
  /**
   * Contains the events and their callbacks
   * @var array
   */
  protected $_registry = array();

  /**
   * Connects a callback to an event
   * @param  string $event     Name of the event
   * @param  mixed  $callback  Could be an Object implementing the
   *                           Spark_Event_Handler_Interface, the name of a global
   *                           callback function or a closure (as of PHP > 5.3.0)
   *
   * @return Spark_Event_Dispatcher Providing a fluent interface
   */
  public function register($event, $callback)
  {
    if(!is_string($event)) {
      throw new InvalidArgumentException("The name of the event must be a string");
    }

    if (!isset($this->_registry[$event])) {
      $this->_registry[$event] = array();
    }

    if ($callback instanceof Spark_Event_HandlerInterface) {
        $callback = new Spark_Event_Handler($callback, "handleEvent");
    } else  {
        $callback = new Spark_Event_Handler($callback);
    }

    array_unshift($this->_registry[$event], $callback);

    return $this;
  }

  /**
   * Shortcut for registering a handler on an event
   * @see register()
   */
  public function on($event, $callback)
  {
    return $this->register($event, $callback);
  }

  /**
   * Triggers (fires) an event
   * @param  string $event   Name of the Event which should be triggered
   * @param  object $context The Object context in which the Event got triggered
   *
   * @return Spark_Event_Event Contains status information about the event
   */
  public function trigger($event, $eventObj = null)
  {
    if(!is_string($event)) {
      throw new InvalidArgumentException("The name of the event must be a string");
    }

    if(is_null($eventObj)) {
      $eventObj = new Spark_Event_Event;
    }

    $eventObj->setName($event);

    if($this->hasCallbacks($event)) {

      foreach($this->_registry[$event] as $callback) {
        $callback->call($eventObj);
        $eventObj->setDispatched();
      }
    }

    return $eventObj;
  }

  /**
   * Checks if callbacks were registered for a certain event
   * @param  string  event
   * @return boolean
   */
  public function hasCallbacks($event)
  {
    if( !is_string($event) ) {
      throw new InvalidArgumentException("The name of the event must be a string");
    }
    return isset($this->_registry[$event]) ? true : false;
  }

}

?>


text:
package com.mingle.pulltonextlayout.adapter;

import android.content.Context;
import android.support.annotation.LayoutRes;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.mingle.pulltonextlayout.BaseAdapter;
import com.mingle.pulltonextlayout.PullToNextEntity;
import com.mingle.pulltonextlayout.model.PullToNextModel;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * Created by zzz40500 on 15/5/30.
 */
public class PullToNextModelAdapter extends BaseAdapter<PullToNextModel> {
    private SparseArray<List<View>> holderMap = new SparseArray<>();

    private Context context;

    public PullToNextModelAdapter(Context context, List<PullToNextModel> list) {
        super(list);
        this.context = context;
    }

    @Override
    protected void cleanAll() {
        holderMap.clear();
    }

    @Override
    public void setOnItemVisibility(int position, boolean userVisibleHint) {

        PullToNextModel model = list.get(position);

        if (model.isUserVisibleHint() != userVisibleHint) {
            model.setUserVisibleHint(userVisibleHint);
        }
    }

    @Override
    protected void attachContentView(PullToNextEntity pullToNextEntity) {

        PullToNextModel model = list.get(pullToNextEntity.getPosition());
        View view = getConvertView(model.getLayoutViewId());

        if (!model.isCreate()) {
            model.onCreate(context);
            model.setCreate(true);
        }
        model.setView(view);
        ViewGroup parentView = (ViewGroup) pullToNextEntity.getPullToNextView().findViewById(pullToNextEntity.getContentId());
        parentView.removeAllViews();
        parentView.addView(view);
        model.onBindView(pullToNextEntity.getPosition(), view, pullToNextEntity.getPullToNextView());
        model.onResumeView(pullToNextEntity.getPosition(),view,pullToNextEntity.getPullToNextView());
    }

    @Override
    protected void detachContentView(PullToNextEntity pullToNextEntity) {
        PullToNextModel model = list.get(pullToNextEntity.getPosition());
        ViewGroup parentView = (ViewGroup) pullToNextEntity.getPullToNextView().findViewById(pullToNextEntity.getContentId());
        model.onPauseView(pullToNextEntity.getPosition(), model.getView(), pullToNextEntity.getPullToNextView());
        model.onUnBindView(pullToNextEntity.getPosition(), model.getView(), pullToNextEntity.getPullToNextView());
        parentView.removeView(model.getView());
        model.setView(null);
    }

    @Override
    public View getContentView(int position) {
        PullToNextModel model = list.get(position);
        return model.getView();
    }

    /**
     * 实现 contentView 的复用
     * @param id
     * @return
     */
    private View getConvertView(@LayoutRes int id) {

        List<View> views = holderMap.get(id);
        View v = null;
        if (views != null) {

            for (int i = 0; i < views.size(); i++) {
                View item = views.get(i);
                if (item.getParent() == null) {
                    v = item;
                    break;
                }
            }

            if (v == null) {
                v = LayoutInflater.from(context).inflate(id, null);
                views.add(v);
            }

        } else {
            views = new ArrayList<>();
            v = LayoutInflater.from(context).inflate(id, null);
            views.add(v);
            holderMap.put(id,views);
        }
        return v;

    }

    public void notifyDataSetChanged() {
        mDataSetObservable.notifyChanged();
    }
}


text:
@interface LibraryServerCollectionItem : NSCollectionViewItem {

}

@end


text:
{-# LANGUAGE OverloadedStrings #-}
module Binary.Safe where

import Control.Applicative
import Control.Monad
import Data.Binary
import Data.ByteString.Char8 (ByteString)
import Data.Vect
import Foreign
import qualified Data.ByteString.Char8 as SB
import qualified Data.ByteString.Lazy as LB
import qualified Data.Vector.Storable as V
import qualified Data.Vector.Storable.Mutable as M

import GraphicsPipeline

instance Binary Vec2 where
    put (Vec2 a b) = put a >> put b
    get = Vec2 <$> get <*> get

instance Binary Vec3 where
    put (Vec3 a b c) = put a >> put b >> put c
    get = Vec3 <$> get <*> get <*> get

instance Binary Vec4 where
    put (Vec4 a b c d) = put a >> put b >> put c >> put d
    get = Vec4 <$> get <*> get <*> get <*> get

instance Binary Mat2 where
    put (Mat2 a b) = put a >> put b
    get = Mat2 <$> get <*> get

instance Binary Mat3 where
    put (Mat3 a b c) = put a >> put b >> put c
    get = Mat3 <$> get <*> get <*> get

instance Binary Mat4 where
    put (Mat4 a b c d) = put a >> put b >> put c >> put d
    get = Mat4 <$> get <*> get <*> get <*> get

instance (Storable a, Binary a) => Binary (V.Vector a) where
    put v = do
        put (V.length v)
        mapM_ put (V.toList v)

    -- this is morally sound, if very awkward.
    -- all effects are contained, and can't escape the unsafeFreeze
    {-# INLINE get #-}
    get = do
        n  <- get

        -- new unitinialized array
        mv <- lift $ M.new n

        let fill i
                | i < n = do
                    x <- get
                    (unsafePerformIO $ M.unsafeWrite mv i x) `seq` return ()
                    fill (i+1)

                | otherwise = return ()

        fill 0

        lift $ V.unsafeFreeze mv

lift = return .unsafePerformIO

fileVersion :: Int32
fileVersion = 1

loadMesh :: ByteString -> IO Mesh
loadMesh n = decode <$> LB.readFile (SB.unpack n)

saveMesh :: ByteString -> Mesh -> IO ()
saveMesh n m = LB.writeFile (SB.unpack n) (encode m)

instance Binary Attribute where
    put (A_Float a) = putWord8 0 >> put a
    put (A_Vec2 a)  = putWord8 1 >> put a
    put (A_Vec3 a)  = putWord8 2 >> put a
    put (A_Vec4 a)  = putWord8 3 >> put a
    put (A_Mat2 a)  = putWord8 4 >> put a
    put (A_Mat3 a)  = putWord8 5 >> put a
    put (A_Mat4 a)  = putWord8 6 >> put a
    put (A_Int a)   = putWord8 7 >> put a
    put (A_Word a)  = putWord8 8 >> put a
    get = do
        tag_ <- getWord8
        case tag_ of
            0 -> A_Float <$> get
            1 -> A_Vec2  <$> get
            2 -> A_Vec3  <$> get
            3 -> A_Vec4  <$> get
            4 -> A_Mat2  <$> get
            5 -> A_Mat3  <$> get
            6 -> A_Mat4  <$> get
            7 -> A_Int   <$> get
            8 -> A_Word  <$> get
            _ -> fail "no parse"

putIndices :: V.Vector Int -> Put
putIndices i = put $ V.map (fromIntegral :: Int -> Int32) i

getIndices :: Get (V.Vector Int)
getIndices = V.map (fromIntegral :: Int32 -> Int) <$> get

instance Binary Primitive where
    put Points             = putWord8 0
    put TriangleStrip      = putWord8 1
    put Triangles          = putWord8 2
    put (TriangleStripI a) = putWord8 3 >> putIndices a
    put (TrianglesI a)     = putWord8 4 >> putIndices a
    get = do
        tag_ <- getWord8
        case tag_ of
            0 -> return Points
            1 -> return TriangleStrip
            2 -> return Triangles
            3 -> TriangleStripI <$> getIndices
            4 -> TrianglesI <$> getIndices
            _ -> fail "no parse"

instance Binary Mesh where
    put (Mesh a b) = put a >> put b
    get = Mesh <$> get <*> get


text:
import { isFunction, isString } from './utils/type-check';

export default {
  position({ top, left }) {
    if (!this.options.shift) {
      return;
    }

    let { shift } = this.options;
    if (isFunction(shift)) {
      shift = shift.call(this, { top, left });
    }

    let shiftTop, shiftLeft;
    if (isString(shift)) {
      shift = shift.split(' ');
      shift[1] = shift[1] || shift[0];

      ([shiftTop, shiftLeft] = shift);

      shiftTop = parseFloat(shiftTop, 10);
      shiftLeft = parseFloat(shiftLeft, 10);
    } else {
      ([shiftTop, shiftLeft] = [shift.top, shift.left]);
    }

    top += shiftTop;
    left += shiftLeft;

    return { top, left };
  }
};


text:
define({
  "sourceSetting": "Pretraži postavke izvora",
  "instruction": "Dodaj i konfiguriši servise za geokodiranje ili slojeve geoobjekata kao izvore pretrage. Ovi navedeni izvori određuju šta može da se pretražuje unutar trake za pretragu.",
  "add": "Dodaj izvor pretrage",
  "addGeocoder": "Dodaj geokoder",
  "geocoder": "Geokoder",
  "setLayerSource": "Postavi izvor sloja",
  "setGeocoderURL": "Postavi URL adresu geokôdera",
  "searchableLayer": "Sloj geoobjekata",
  "name": "Naziv",
  "countryCode": "Kôd(ovi) zemlje ili regiona",
  "countryCodeEg": "npr. ",
  "countryCodeHint": "Ako ova vrednost ostane prazna, pretražuju se sve zemlje i regioni",
  "generalSetting": "Opšte postavke",
  "allPlaceholder": "Tekst čuvara mesta za pretragu svega: ",
  "showInfoWindowOnSelect": "Prikaži iskačući prozor za pronađeni geoobjekat ili lokaciju",
  "searchInCurrentMapExtent": "Pretraži samo u trenutnom obuhvatu mape",
  "zoomScale": "Skala zumiranja",
  "locatorUrl": "URL adresa geokodera",
  "locatorName": "Ime geokodera",
  "locatorExample": "Primer",
  "locatorWarning": "Ova verzija servisa geokôdiranja nije podržana. Vidžet podržava samo servis geokôdiranja 10.0 i novije.",
  "locatorTips": "Predlozi nisu dostupni jer servis geokôdiranja ne podržava predloženu mogućnost.",
  "layerSource": "Izvor sloja",
  "searchLayerTips": "Predlozi nisu dostupni jer servis geoobjekata ne podržava mogućnost paginacije.",
  "placeholder": "Tekst čuvara mesta",
  "searchFields": "Polja za pretragu",
  "displayField": "Prikaži polje",
  "exactMatch": "Potpuno podudaranje",
  "maxSuggestions": "Maksimalno predloga",
  "maxResults": "Maksimalno rezultata",
  "enableLocalSearch": "Omogući lokalnu pretragu",
  "minScale": "Min. razmera",
  "minScaleHint": "Kada je razmera mape veća od ove razmere, primenjuje se lokalna pretraga",
  "radius": "Poluprečnik",
  "radiusHint": "Definiše poluprečnik oblasti oko trenutnog centra mape koja se koristi za poboljšavanje rangiranja kandidata za geokodiranje kako bi se prvo vraćali kandidati najbliži lokaciji",
  "meters": "Metri",
  "setSearchFields": "Postavi polja pretrage",
  "set": "Postavi",
  "fieldSearchable": "pretraživo",
  "fieldName": "Naziv",
  "fieldAlias": "Alias",
  "ok": "U redu",
  "cancel": "Otkaži",
  "invalidUrlTip": "URL adresa ${URL} nije validna ili nije dostupna."
});


text:
package org.vaadin.addons.rinne

import com.vaadin.event.ShortcutListener
import com.vaadin.server.ThemeResource
import org.scalatest.FunSpec

class AbstractComponentMixinSpec extends FunSpec {

  describe("An AbstractComponentMixinSpec") {

    describe("should allow to set") {

      it("data") {
        val field = new VTextField

        field.data = "opa"
        assert(field.data === "opa")
      }

      it("immediate") {
        val field = new VTextField

        assert(field.immediate === false)
        field.immediate = true
        assert(field.immediate === true)
      }

      it("description") {
        val field = new VTextField

        field.description = "qwe"
        assert(field.description === Some("qwe"))

        field.description = None
        assert(field.description === None)
      }
    }
  }

  describe("shortcutListeners should") {

    val listener1 = (e: Any) => println(e)

    it("shortcutListeners.add a listener to table") {
      val table = new VTable
      val action = new KeyShortcutAction("aaa", KeyShortcut(KeyCode.A, KeyModifier.Shift), {})

      table.shortcutListeners += action
      assert(table.shortcutListeners.size === 1)
    }

    it("shortcutListeners.remove an action from table") {
      val table = new VTable
      val action = new KeyShortcutAction("aaa", KeyShortcut(KeyCode.A), {})

      table.shortcutListeners += action
      table.shortcutListeners -= action

      assert(table.shortcutListeners.size === 0)
    }

    it("shortcutListeners.remove a listener from table") {
      val table = new VTable
      val action2 = new KeyShortcutAction("aac", new ThemeResource("aaa"), KeyShortcut(KeyCode.C), {})

      table.shortcutListeners += action2
      table.shortcutListeners -= action2

      assert(table.shortcutListeners.size === 0)
    }

    it("shortcutListeners.iterator returns added listeners") {
      val table = new VTable

      var action1executed = false
      var action2executed = false

      val action1 = new KeyShortcutAction("aaa", {
        action1executed = true
      }, KeyModifier.Shift)
      val action2 = new KeyShortcutAction("aac", KeyShortcut(KeyCode.C), {
        action2executed = true
      })

      table.shortcutListeners += action1
      table.shortcutListeners += action2

      val iter = table.shortcutListeners.iterator
      iter.next().apply(null)
      iter.next().apply(null)
      assert(!iter.hasNext)
      assert(action1executed)
      assert(action2executed)
    }

    it("shortcutListeners.contains returns false for non-added listener") {
      val table = new VTable

      assert(!table.shortcutListeners.contains(listener1))
    }

    it("execute listeners") {
      var executed = false
      val table = new VTable {
        shortcutListeners += new KeyShortcutAction("aaa", (_, _) => {
          executed = true
        }, KeyModifier.Shift)
      }

      import scala.collection.JavaConverters._
      table.shortcutListeners.listeners.asScala
        .foreach { case e: ShortcutListener => e.handleAction(null, null) }
      assert(executed)
    }
  }
}


text:
import pickle

from .. import units as pq
from ..uncertainquantity import UncertainQuantity
from .. import constants
from .common import TestCase

class TestPersistence(TestCase):

    def test_unitquantity_persistance(self):
        x = pq.m
        y = pickle.loads(pickle.dumps(x))
        self.assertQuantityEqual(x, y)

        x = pq.CompoundUnit("pc/cm**3")
        y = pickle.loads(pickle.dumps(x))
        self.assertQuantityEqual(x, y)

    def test_quantity_persistance(self):
        x = 20*pq.m
        y = pickle.loads(pickle.dumps(x))
        self.assertQuantityEqual(x, y)

    def test_uncertainquantity_persistance(self):
        x = UncertainQuantity(20, 'm', 0.2)
        y = pickle.loads(pickle.dumps(x))
        self.assertQuantityEqual(x, y)

    def test_unitconstant_persistance(self):
        x = constants.m_e
        y = pickle.loads(pickle.dumps(x))
        self.assertQuantityEqual(x, y)


text:
package controler

import (
	"bytes"
	"fmt"

	"github.com/jackmanlabs/codegen"
)

func Insert(def *codegen.Model) string {

	// TODO: Find a better way of determining the primary key.
	pkey := def.Members[0]

	model := def.Name
	handler := bytes.NewBuffer(nil)

	fmt.Fprintf(handler, "func Insert%s(x *types.%s) (*types.%s, error) {\n", model, model, model)
	//fmt.Fprintf(handler, "x.%s= uuid.New()\n", index.ColumnName)

	fmt.Fprint(handler, `
	tx, err := data.Tx()
	if err != nil {
		return nil, errors.Stack(err)
	}
	`)

	fmt.Fprintf(handler, "err = data.Insert%sTx(tx, x)\n", model)
	fmt.Fprint(handler, `
	if err != nil {
		tx.Rollback()
		return nil, errors.Stack(err)
	}
`)

	fmt.Fprintf(handler, "x_, err := data.Get%sTx(tx, x.%s)\n", model, pkey.GoName)
	fmt.Fprint(handler, `
	if err != nil {
		tx.Rollback()
		return nil, errors.Stack(err)
	}

	err = tx.Commit()
	if err != nil {
		return nil, errors.Stack(err)
	}

	return x_, nil
}
	`)

	return handler.String()
}


text:
import Ember from "ember";
import RowEventsMixin from 'ember-inspector/mixins/row-events';
const { computed, Component, String: { htmlSafe } } = Ember;
const { not, bool, equal } = computed;

export default Component.extend(RowEventsMixin, {
  /**
   * No tag. This component should not affect
   * the DOM.
   *
   * @property tagName
   * @type {String}
   * @default ''
   */
  tagName: '',

  /**
   * Has a view (component) instance.
   *
   * @property hasView
   * @type {Boolean}
   */
  hasView: bool('model.value.viewClass'),

  /**
   * Whether it has a tag or not.
   *
   * @property isTagless
   * @type {Boolean}
   */
  isTagless: equal('model.value.tagName', ''),

  /**
   * Whether it has an element or not (depends on the tagName).
   *
   * @property hasElement
   * @type {Boolean}
   */
  hasElement: not('isTagless'),

  /**
   * Whether it has a layout/template or not.
   *
   * @property hasTemplate
   * @type {Boolean}
   */
  hasTemplate: bool('model.value.template'),

  hasModel: bool('model.value.model'),

  hasController: bool('model.value.controller'),

  /**
   * The index of the current row. Currently used for the
   * `RowEvents` mixin. This property is passed through
   * the template.
   *
   * @property index
   * @type {Number}
   * @default null
   */
  index: null,

  modelInspectable: computed('hasModel', 'model.value.model.type', function() {
    return this.get('hasModel') && this.get('model.value.model.type') === 'type-ember-object';
  }),

  labelStyle: computed('model.parentCount', function() {
    return htmlSafe(`padding-left: ${+this.get('model.parentCount') * 20 + 5}px;`);
  }),

  actions: {
    inspectView() {
      if (this.get('hasView')) {
        this.sendAction('inspect', this.get('model.value.objectId'));
      }
    },
    inspectElement(objectId) {
      let elementId;
      if (!objectId && this.get('hasElement')) {
        objectId = this.get('model.value.objectId');
      }
      if (!objectId) {
        elementId = this.get('model.value.elementId');
      }
      if (objectId || elementId) {
        this.sendAction('inspectElement', { objectId, elementId });
      }
    },
    inspectModel(objectId) {
      if (this.get('modelInspectable')) {
        this.sendAction('inspect', objectId);
      }
    }
  }
});


text:
package xal.tools.correlator;

import xal.tools.messaging.MessageCenter;

/**
 * PassiveBroadcaster maintains the most recent best correlation (as determined by count) and broadcasts the correlation (or "noCorrelationCaught()") only when instigated.
 * @author  tap
 */
class PassiveBroadcaster<RecordType> extends AbstractBroadcaster<RecordType> {
    private Correlation<RecordType> bestPartialCorrelation;   // less than full count
    private boolean isFresh;

    /** Creates a new instance of Broadcaster */
    public PassiveBroadcaster( final MessageCenter aLocalCenter ) {
		super( aLocalCenter );
        isFresh = false;
        bestPartialCorrelation = null;
	}

    /**
	 * Get the best partial correlation at this time.
	 * @return the best partial correlation.
	 */
    synchronized Correlation<RecordType> getBestPartialCorrelation() {
        return bestPartialCorrelation;
    }

    /**
     * Post the best partial correlation when requested since a full correlation
     * may not be available.
     */
    synchronized void postBestPartialCorrelation() {
        if ( isFresh ) {
            postCorrelation( bestPartialCorrelation );
			isFresh = false;
        }
        else {
            correlationProxy.noCorrelationCaught( this );
        }
    }

    /**
     * Handle the BinListener event by comparing the number of correlated records and saving it as the best
	 * correlation if it has more than the previous best.  It never posts events, but the best correlation
	 * can be requested at any time.
	 * @param sender The bin agent that published the new correlation.
	 * @param correlation The new correlation.
     */
    synchronized public void newCorrelation( final BinAgent<RecordType> sender, Correlation<RecordType> correlation ) {
        if ( !isFresh || (correlation.numRecords() >= bestPartialCorrelation.numRecords() ) ) {
            bestPartialCorrelation = correlation;
            isFresh = true;
        }
    }
}


text:
package com.github.shyykoserhiy.bencode.parser;

import com.github.shyykoserhiy.bencode.exception.BParsingException;
import com.github.shyykoserhiy.bencode.type.*;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author shyyko
 */
public class BParser {
    /**
     * @param toConvert string in bencoded format
     * @param index     current index
     * @return java version of bencode value
     */
    public static IBValue fromBencodedValue(String toConvert, AtomicInteger index) throws BParsingException {
        char currentCharacter = toConvert.charAt(index.get());
        if (currentCharacter == BInteger.START_SYMBOL) {
            return BInteger.fromBencodedValue(toConvert, index);
        } else if (currentCharacter == BList.START_SYMBOL) {
            return BList.fromBencodedValue(toConvert, index);
        } else if (currentCharacter == BMap.START_SYMBOL) {
            return BMap.fromBencodedValue(toConvert, index);
        } else if (Character.isDigit(currentCharacter)) {
            return BString.fromBencodedValue(toConvert, index);
        } else {
            throw new BParsingException("Invalid bencoded data at: " + index.get() + ", char " + currentCharacter);
        }
    }
}


text:
package org.n52.sos.request;

import org.n52.sos.ogc.gml.time.Time;
import org.n52.sos.ogc.sos.SosConstants;
import org.n52.sos.util.StringHelper;

/**
 * SOS DescribeSensor request
 *
 * @since 4.0.0
 */
public class DescribeSensorRequest extends AbstractServiceRequest {

    /**
     * Procedure identifier
     */
    private String procedure;

    /**
     * Output format
     */
    private String procedureDescriptionFormat;

    /**
     * Temporal filters
     */
    private Time validTime;

    /*
     * (non-Javadoc)
     *
     * @see org.n52.sos.request.AbstractSosRequest#getOperationName()
     */
    @Override
    public String getOperationName() {
        return SosConstants.Operations.DescribeSensor.name();
    }

    /**
     * Get output format
     *
     * @return output format
     */
    public String getProcedureDescriptionFormat() {
        return procedureDescriptionFormat;
    }

    /**
     * Set output format
     *
     * @param procedureDescriptionFormat
     *            output format
     */
    public void setProcedureDescriptionFormat(String procedureDescriptionFormat) {
        this.procedureDescriptionFormat = procedureDescriptionFormat;
    }

    public boolean isSetProcedureDescriptionFormat() {
        return StringHelper.isNotEmpty(getProcedureDescriptionFormat());
    }

    /**
     * Get Procedure identifier
     *
     * @return Procedure identifier
     */
    public String getProcedure() {
        return procedure;
    }

    /**
     * Set Procedure identifier
     *
     * @param procedure
     *            Procedure identifier
     */
    public void setProcedure(String procedure) {
        this.procedure = procedure;
    }

    public boolean isSetProcedure() {
        return StringHelper.isNotEmpty(getProcedure());
    }

    /**
     * Get valid time
     *
     * @return valid time
     */
    public Time getValidTime() {
        return validTime;
    }

    /**
     * Set valid time
     *
     * @param validTime
     *            valid time
     */
    public void setValidTime(Time validTime) {
        this.validTime = validTime;
    }

    public boolean isSetValidTime() {
        return getValidTime() != null;
    }
}


text:
layout: post
title: "Let it Snow"
subtitle: "How about noooooo."
header-img: "snow.jpg"
tag: rage
collection: "Rage"
collection-url: "/rage"
credit: "https://www.flickr.com/photos/simon__syon/"
---

Me yesterday when it started snowing:

Look outside! It's snowing! It's so pretty! Wanna build a snowman?

Me today when I was walking outside:

Shit shit shit shit

That is the end of this blog post.


text:
package com.github.mybatis.interceptor;

import org.apache.ibatis.reflection.DefaultReflectorFactory;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.ReflectorFactory;
import org.apache.ibatis.reflection.factory.DefaultObjectFactory;
import org.apache.ibatis.reflection.factory.ObjectFactory;
import org.apache.ibatis.reflection.wrapper.DefaultObjectWrapperFactory;
import org.apache.ibatis.reflection.wrapper.ObjectWrapperFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 拦截器基类
 */

public abstract class BaseInterceptor {
  static final ReflectorFactory REFLECTOR_FACTORY = new DefaultReflectorFactory();
  static final DefaultObjectFactory OBJECT_FACTORY = new DefaultObjectFactory();
  static final DefaultObjectWrapperFactory OBJECT_WRAPPER_FACTORY = new DefaultObjectWrapperFactory();
  protected Logger logger = LoggerFactory.getLogger(this.getClass());

  /**
   * 获取被拦截的对象(MetaObject包装)
   *
   * @param obj
   * @return
   */
  protected MetaObject getMetaObject(Object obj) {
    ObjectFactory objectFactory = OBJECT_FACTORY;
    ObjectWrapperFactory objectWrapperFactory = OBJECT_WRAPPER_FACTORY;
    MetaObject metaStatementHandler = MetaObject.forObject(obj, objectFactory, objectWrapperFactory, REFLECTOR_FACTORY);
    // 由于目标类可能被多个拦截器拦截,从而形成多次代理,通过以下循环找出原始代理
    while (metaStatementHandler.hasGetter("h")) {
      Object object = metaStatementHandler.getValue("h");
      metaStatementHandler = MetaObject.forObject(object, objectFactory, objectWrapperFactory, REFLECTOR_FACTORY);
    }
    // 得到原始代理对象的目标类,即StatementHandler实现类
    if (metaStatementHandler.hasGetter("target")) {
      Object object = metaStatementHandler.getValue("target");
      metaStatementHandler = MetaObject.forObject(object, objectFactory, objectWrapperFactory, REFLECTOR_FACTORY);
    }
    return metaStatementHandler;
  }
}


text:
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.psi.codeStyle;

import com.intellij.CodeStyleBundle;
import com.intellij.application.options.CodeStyle;
import com.intellij.openapi.util.NlsContexts;
import com.intellij.openapi.util.text.HtmlBuilder;
import com.intellij.openapi.util.text.HtmlChunk;
import com.intellij.psi.PsiFile;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings.IndentOptions;
import com.intellij.psi.codeStyle.modifier.CodeStyleStatusBarUIContributor;
import com.intellij.ui.ColorUtil;
import com.intellij.ui.JBColor;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public abstract class IndentStatusBarUIContributor implements CodeStyleStatusBarUIContributor {
  private final IndentOptions myIndentOptions;

  public IndentStatusBarUIContributor(IndentOptions options) {
    myIndentOptions = options;
  }

  public IndentOptions getIndentOptions() {
    return myIndentOptions;
  }

  /**
   * Returns a short, usually one-word, string to indicate the source of the given indent options.
   *
   * @return The indent options source hint or {@code null} if not available.
   */
  @Nullable
  public abstract @NlsContexts.HintText String getHint();

  @Nullable
  @Override
  public String getTooltip() {
    return createTooltip(getIndentInfo(myIndentOptions), getHint());
  }

  @Nls
  @NotNull
  public static String getIndentInfo(@NotNull IndentOptions indentOptions) {
    return indentOptions.USE_TAB_CHARACTER
           ? CodeStyleBundle.message("indent.status.bar.tab")
           : CodeStyleBundle.message("indent.status.bar.spaces", indentOptions.INDENT_SIZE);
  }

  /**
   * @return True if "Configure indents for [Language]" action should be available when the provider is active (returns its own indent
   *          options), false otherwise.
   */
  public boolean isShowFileIndentOptionsEnabled() {
    return true;
  }

  @NotNull
  public static @NlsContexts.Tooltip String createTooltip(@Nls String indentInfo, @NlsContexts.HintText String hint) {
    HtmlBuilder builder = new HtmlBuilder();
    builder.append(CodeStyleBundle.message("indent.status.bar.indent.tooltip")).append(indentInfo);
    if (hint != null) {
      builder.nbsp(2).append(HtmlChunk.span("color:"+ColorUtil.toHtmlColor(JBColor.GRAY)).addText(hint));
    }
    return builder.wrapWith("html").toString();
  }

  @NotNull
  @Override
  public String getStatusText(@NotNull PsiFile psiFile) {
    String widgetText = getIndentInfo(myIndentOptions);
    IndentOptions projectIndentOptions = CodeStyle.getSettings(psiFile.getProject()).getLanguageIndentOptions(psiFile.getLanguage());
    if (!projectIndentOptions.equals(myIndentOptions)) {
      widgetText += "*";
    }
    return widgetText;
  }
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>springboot-dubbo-test</artifactId>
        <groupId>com.huang</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>application-redis</artifactId>
    <packaging>jar</packaging>

    <name>application-redis</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </dependency>

    </dependencies>
</project>


text:
from pkgutil import iter_modules
import os

"""
Common utils.
These utils should be irrelevant to tensorflow.
"""

__all__ = []

def _global_import(name):
    p = __import__(name, globals(), None, level=1)
    lst = p.__all__ if '__all__' in dir(p) else dir(p)
    for k in lst:
        globals()[k] = p.__dict__[k]
        __all__.append(k)

_TO_IMPORT = set([
    'naming',
    'utils',
    'gpu'   # TODO don't export it
])

_CURR_DIR = os.path.dirname(__file__)
for _, module_name, _ in iter_modules(
        [_CURR_DIR]):
    srcpath = os.path.join(_CURR_DIR, module_name + '.py')
    if not os.path.isfile(srcpath):
        continue
    if module_name.startswith('_'):
        continue
    if module_name in _TO_IMPORT:
        _global_import(module_name)
    else:
        __all__.append(module_name)


text:
Sponsors of Read the Docs
=========================

Running Read the Docs isn't free, and the site wouldn't be where it is today
without generous support of our sponsors. Below is a list of all the folks who
have helped the site financially, in order of the date they first started
supporting us.

Current sponsors
----------------

* `Twilio`_ - Twilio, a user of Read the Docs, is organizing `Signal`_, a
  developer conference for communications, held May 19-20th.
* `Rackspace`_ - They cover all of our hosting expenses every month.  This is a pretty large sum of money, and we are really grateful to have them as a sponsor.
* You? (Email us at hello@readthedocs.com for more info)

Past sponsors
-------------

* Revsys_
* `Python Software Foundation`_
* `Mozilla Web Dev`_
* `Django Software Foundation`_
* Lab305_

.. _Revsys: http://www.revsys.com/
.. _Python Software Foundation: http://python.org/psf/
.. _Mozilla Web Dev: http://blog.mozilla.com/webdev/
.. _Django Software Foundation: https://www.djangoproject.com/foundation/
.. _Lab305: http://www.lab305.com/
.. _Rackspace: http://www.rackspace.com/

.. _Twilio: http://twilio.com/
.. _Signal: http://signal.twilio.com/

Sponsorship Information
-----------------------

As part of increasing sustainability, Read the Docs is testing out several spots
for promoting sponsors on documentation pages. We are only seeking sponsors that
are users of the service or are at least very familiar with the service.

Sponsor Us
~~~~~~~~~~

Contact us at hello@readthedocs.com for more information on sponsoring Read the Docs.

Doc Page Promotion
~~~~~~~~~~~~~~~~~~

This promotion is our best offering, it will display on the bottom of the
navigation menu on all built documentation.  This space includes a 120x90 image
and supporting ad text on every documentation page using the Read the Docs
theme, which is over 10,000,000 pageviews every month.

User experience on documentation pages is paramount, and any sponsored ads are
strictly image and text -- no dynamic components, animations, or tracking pixels
are allowed. This space will not interfere with the navigation menu, and will
only show if the menu is short enough, or the reader has scrolled down on the
page past the end of the menu.  This promotion is not displayed for users with
gold status, or users that have donated in the past.

Limited to *1* company per month.

`Contact us`_ for more specifications on this promotion spot.

.. _`Contact us`: mailto:hello@readthedocs.com

Footer Logo Promotion
~~~~~~~~~~~~~~~~~~~~~

This promotion displays the name of your company in the footer of docuentation pages.
It is a rotation of all sponsors,
so will vary in pageviews based on the number of supporting companies.
We will never have more than *10* companies in this promotion at any time.


text:
import chai from 'chai';
import fs from 'fs-extra';
import Twitter from '../src/Twitter';
import path from 'path';
import utils from '../src/lib/utils';
import prettyjson from 'prettyjson';
import { AKILIHUB_API } from '../config';

const expect = chai.expect;
/* eslint-disable func-names */
describe('twitter worker tests', function () {
  let data = null;
  this.timeout(5000);

  before((done) => {
    const file = path.resolve(__dirname, './data/tw-allan.json');
    fs.readJson(file, (err, json) => {
      /* eslint-disable no-console */
      if (err) console.error(err);
      data = json;
      done();
    });
  });
  it.skip('should send data to remote', async (done) => {
    const payload = [
      { name: 'allan' },
      { name: 'ak' },
    ];
    utils.sendPayload(payload, AKILIHUB_API, (body) => {
      console.log(prettyjson.render(body));
      expect(body).to.be.an('object');
      done();
    });
  });

  it('should process data and send to remote', async(done) => {
    const twitter = new Twitter(data);
    try {
      const processedData = await twitter.processData();
      // console.log(prettyjson.render(processedData[0]));
      utils.sendPayload(processedData, AKILIHUB_API, (body) => {
        console.log(body);
        expect(body).to.be.an('object');
        done();
      });
    } catch (err) {
      console.log(err.message);
    }
  });
});


text:
class AddReferredUserIdToUsers < ActiveRecord::Migration
  def change
    add_column :users, :referred_user_id, :integer
  end
end


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Revis. gen. pl. (Leipzig) 3(2): 452 (1898)

#### Original name
Lenzites madagascariensis Henn.

### Remarks
null


text:
<?php

namespace humhub\modules\search\events;

/**
 * This event is used when an object is added to search index
 *
 * @author luke
 * @since 0.21
 */
class SearchAddEvent extends \yii\base\Event
{

    /**
     * @var array Reference to the currently added search attributes
     */
    public $attributes;

    /**
     * @inheritdoc
     */
    public function __construct(&$attributes)
    {
        $this->attributes = &$attributes;
        $this->init();
    }

}


text:
using System.Windows;
using System.Windows.Input;
using FSMControl.DomainModel.FirstVersion;
using FSMControl.DomainModel.SecondVersion;

namespace FSMControl.Windows
{
  /// <summary>
  /// Interaction logic for DeleteVertexWindow.xaml
  /// </summary>
  public partial class DeleteVertexWindow : Window
  {
    private StateMachine machine;

    public DeleteVertexWindow(StateMachine fsm)
      : this()
    {
      if (fsm is FirstStateMachine)
      {
        this.machine = new FirstStateMachine(fsm.CurrentVersion);
      }
      else
      {
        if (fsm is SecondStateMachine)
        {
          this.machine = new SecondStateMachine(fsm.CurrentVersion);
        }
      }

      this.machine = fsm;
      this.autocomplete.ItemsSource = this.machine.MyGraph.Vertices;
    }

    public DeleteVertexWindow()
    {
      this.InitializeComponent();
    }

    private void BtnDeleteVertex(object sender, RoutedEventArgs e)
    {
      if (this.machine != null)
      {
        if (this.machine is FirstStateMachine)
        {
          MessageBox.Show(((FirstStateMachine)this.machine).DeleteVertex(autocomplete.Text));
        }
        else
        {
          MessageBox.Show(((SecondStateMachine)this.machine).DeleteVertex(autocomplete.Text));
        }

        this.DataContext = this.machine.MyGraph;
      }
    }

    private void Cancel(object sender, RoutedEventArgs e)
    {
      this.Close();
    }

    private void Autocomplete_MouseEnter(object sender, MouseEventArgs e)
    {
      autocomplete.Text = string.Empty;
    }
  }
}


text:
class SuperDict(dict):
    def __init__(self, data=None):
        if data is not None:
            for k, v in data.items():
                self[k] = SuperDict(v) if isinstance(v, dict) else v

    def __getattr__(self, attrname):
        if attrname not in self:
            self[attrname] = SuperDict()
        return self[attrname]

    def __setattr__(self, attrname, value):
        self[attrname] = value

    def __delattr__(self, attrname):
        del self[attrname]

    def copy(self):
        return SuperDict(super(SuperDict, self).copy())


text:
require "spec_helper"
require "support/shared_examples.rb"

load "pre_commit/checkers/rspec_is_expected_to_checker.rb"

RSpec.describe RspecIsExpectedToChecker do
  let(:checker_class) { RspecIsExpectedToChecker }

  context "code without any issues" do
    subject(:checker) { test_class_with_change(checker_class, "Hello") }
    it_should_behave_like "it finds no error"
  end

  context "code with a SHOULD" do
    subject(:checker) { test_class_with_change(checker_class, "foo.should eq 3") }
    it_should_behave_like "it finds no error"
  end

  context "code with an 'is_expected.to'" do
    subject(:checker) { test_class_with_change(checker_class, "it { is_expected.to eq 3 }") }
    it_should_behave_like "it finds an error"
  end

  context "code with an 'is_expected.to_not'" do
    subject(:checker) { test_class_with_change(checker_class, "it { is_expected.to_not eq 3 }") }
    it_should_behave_like "it finds an error"
  end
end


text:
Chocolat
========

## What is Chocolat?

Chocolat is a Keen.io-compatible API server for Collecting Event Data, and Analyzing. Most of data analysis services don't allow to use event data directly. Bring event data of your service.

### Why Keen.io?

[Keen.io](https://keen.io/) is awesome, and developer-friendly service. SDK is well-documented, and [a lot of open sources](https://github.com/keen) are provided. By building keen.io-compatible API server, we can use plenty of resources. If you need robust support (stability, scalability, etc), then use Keen.io.

### Status

Chocolat is in active development.

Currently, it just works at local development environment. It uses MongoDB as event data store, and aggregation framework. So far, I've concentrated on API specification, so chocolat just like skeleton. From now, Data collecting and Aggregation feature should aim high performance, and scalability.

## Getting Started

### Prerequisites

* Go 1.4+
* MongoDB 2.2+
* Sqlite3 (development)
* Mysql, Postgres (production)

### How to run

Clone this repository:

    git clone https://github.com/angdev/chocolat.git

Install go package dependencies:

    go get . && go get bitbucket.org/liamstask/goose/cmd/goose

Initialize a database:

    goose up

Build and Run:

    go build && ./chocolat -r

Before you run chocolat, check out `config/dbconf.yml`, `config/repoconf.yml`.

### Using with Keen.io SDK

Create a new project:

    ./chocolat -c

Then chocolat prints `PROJECT_ID`, `MASTER_KEY`, `READ_KEY`, `WRITE_KEY`.

And you can use chocolat with keen.io sdk like below (JS SDK example):

```javascript
<script src="//cdn.jsdelivr.net/keen.js/3.2.5/keen.min.js" type="text/javascript"></script>
<script type="text/javascript">
  var client = new Keen({
    projectId: "{{PROJECT_ID}}",
    writeKey: "{{WRITE_KEY}}",
    readKey: "{{READ_KEY}}",
    protocol: "http",
    host: "localhost:3000",
  });
</script>
```

## Roadmap

Chocolat will be multi-components service. Even if chocolat is just api server now, but a lot of components (event aggregation service, message queue, ...) will be built.

### Backlog

* Testing (Unit test, Integration test)
* Mass event collecting
* Fast event aggregation
* Worker (e.g. Daily Report)
* Dockerize

## License

MIT License. See LICENSE for details.

## Credits

* [Keen.io](https://keen.io/)
* Keen.io open sources contributors


text:
Meteor.publish('websites', function(){
  return Websites.find({deleted: false});
});


text:
<!DOCTYPE html>

  <meta charset="utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>tcex.notifications.notifications — TcEx 2.0.15 documentation</title>

  <link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

    <link rel="index" title="Index" href="../../../genindex.html" />
    <link rel="search" title="Search" href="../../../search.html" />

             TcEx

                2.0.15

  <form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>

Table of Contents

Overview

Features

Building Apps: Quick Start

Building Apps: Templates (tcinit)

Building Apps: Dependencies (tclib)

Building Apps: Packaging (tcpackage)

App-Deployment Configuration

App-Directory Structure

Module: Batch

Module: Cache

Module: Case Management

Module: Datastore

Module: Decorators

Module: Metrics

Module: Notifications

Module: Playbooks

Module: Services

Module: Threat Intelligence

Module: Utils

Authorization (Token/HMAC)

Exit

Examples

Logging

Message TC

Parser/Args

Proxies

Results TC

Release Notes

TcEx Package

          TcEx

 »

Module code »

tcex.notifications.notifications

Source code for tcex.notifications.notifications

"""TcEx Notification Module"""
# standard library
import json

[docs]class Notifications:
    """TcEx Notification Class"""

    def __init__(self, tcex):
        """Initialize the Class properties.

        Args:
            tcex (obj): An instance of TcEx object.
        """
        self.tcex = tcex

        # properties
        self._is_organization = False
        self._notification_type = None
        self._recipients = None
        self._priority = 'Low'

[docs]    def recipients(self, notification_type, recipients, priority='Low'):
        """Set vars for the passed in data. Used for one or more recipient notification.

        .. code-block:: javascript

            {
                "notificationType": notification_type,
                "priority": priority
                "isOrganization": false,
                "recipients": recipients
            }

        Args:
            notification_type (str): The type of notification being sent.
            recipients (str): A comma delimited string of recipients.
            priority (str): The priority: Low, Medium, High.
        """
        self._notification_type = notification_type
        self._recipients = recipients
        self._priority = priority
        self._is_organization = False

[docs]    def org(self, notification_type, priority='Low'):
        """Set vars for the passed in data. Used for org notification.

        .. code-block:: javascript

            {
                "notificationType": notification_type,
                "priority": priority
                "isOrganization": true
            }

        Args:
            notification_type (str): The notification type.
            priority (str): The priority: Low, Medium, High.
        """
        self._notification_type = notification_type
        self._recipients = None
        self._priority = priority
        self._is_organization = True

[docs]    def send(self, message):
        """Send our message

        Args:
            message (str): The message to be sent.

        Returns:
            requests.models.Response: The response from the request.

        """
        body = {
            'notificationType': self._notification_type,
            'priority': self._priority,
            'isOrganization': self._is_organization,
            'message': message,
        }

        if self._recipients:
            body['recipients'] = self._recipients

        self.tcex.log.debug(f'notification body: {json.dumps(body)}')

        # create our tcex resource
        r = self.tcex.session.post('/v2/notifications', json=body)
        if r.status_code == 400:
            # specifically handle unknown users
            self.tcex.log.error(f'Failed to send notification ({r.text})')
        elif not r.ok:  # pragma: no cover
            self.tcex.handle_error(750, [r.status_code, r.text])

        # return response body
        return r.json()

        © Copyright 2016, ThreatConnect Inc


text:
package website.automate.jwebrobot;

import com.beust.jcommander.Parameter;
import website.automate.jwebrobot.executor.ExecutorOptions.ScreenshotType;
import website.automate.jwebrobot.executor.ExecutorOptions.TakeScreenshots;

import java.util.*;

import static java.text.MessageFormat.format;

public class ConfigurationProperties {

    public static final String
        DEFAULT_REPORT_PATH = "./report/report.yaml",
        DEFAULT_SCREENSHOT_PATH = "./report/",
        DEFAULT_SCENARIO_PATH = "./",
        DEFAULT_BROWSER_LOG_LEVEL = "error",
        DEFAULT_MODE = "non_interactive";
    public static final String FIREFOX = "firefox";

    @Parameter(names = "-scenarioPath", description = "Path to a single WAML scenario or WAML project root directory.", required = false)
    private String scenarioPath = DEFAULT_SCENARIO_PATH;

	@Parameter(names = "-scenarioPaths", variableArity = true, description = "Path to a single WAML scenario or WAML project root directory.", required = false)
    private List<String> scenarioPaths = new ArrayList<>();

    @Parameter(names = "-browser", description = "Browser to use for execution (e.g firefox or chrome).", required = false)
    private String browser = System.getProperty("jwebrobot.browser", FIREFOX);

    @Parameter(names = "-browserDriverUrl", description = "Browser driver url.", required = false)
    private String browserDriverUrl = System.getProperty("jwebrobot.browserDriverUrl");

    @Parameter(names = "-context", variableArity = true, required = false)
    private List<String> contextEntries = new ArrayList<>();

    @Parameter(names = "-takeScreenshots", description = "Determines if any and under which condition screenshots must be taken.", required = false)
    private String takeScreenshots = TakeScreenshots.ON_FAILURE.getName();

    @Parameter(names = "-screenshotPath", description = "Path to the directory where created screeshots must be saved.", required = false)
    private String screenshotPath = DEFAULT_SCREENSHOT_PATH;

    @Parameter(names = "-screenshotType", description = "Defines the way screenshots must be taken: fullscreen vs. viewport")
    private String screenshotType = ScreenshotType.VIEW_PORT.getName();

    @Parameter(names = "-screenshotFormat", description = "Defines the screenshot format")
    private String screenshotFormat = "png";

    @Parameter(names = "-timeout", description = "Timeout waiting for conditions to be fulfilled in seconds.", required = false)
    private Long timeout;

    @Parameter(names = "-scenarioPattern", description = "Scenario name pattern. If set, only non fragment scenarios matching the pattern are executed.", required = false)
    private String scenarioPattern;

    @Parameter(names = "-reportPath", description = "Path to which the execution report is written to.", required = false)
    private String reportPath = DEFAULT_REPORT_PATH;

    @Parameter(names = "-browserLogLevel", description = "Log level at which browser logs are included into the reports.", required = false)
    private String browserLogLevel = DEFAULT_BROWSER_LOG_LEVEL;

    @Parameter(names = "-maximizeWindow", description = "Triggers window maximization.", required = false)
    private String maximizeWindow = Boolean.FALSE.toString();

    @Parameter(names = "-mode", description = "Defines the working mode of the jwebrobot.", required = false)
    private String mode = DEFAULT_MODE;

    public List<String> getScenarioPaths() {
        return scenarioPaths;
    }

    public void setScenarioPaths(List<String> scenarioPaths) {
        this.scenarioPaths = scenarioPaths;
    }

    public String getBrowser() {
        return browser;
    }

    public String getBrowserDriverUrl(){
        return browserDriverUrl;
    }

    public void setBrowserDriverUrl(String browserDriverUrl){
        this.browserDriverUrl = browserDriverUrl;
    }

    public void setBrowser(String browser) {
        this.browser = browser;
    }

    public Long getTimeout() {
        return timeout;
    }

    public void setTimeout(Long timeout) {
        this.timeout = timeout;
    }

    public Map<String, Object> getContext(){
        Map<String, Object> contextMap = new HashMap<>();
        for(String contextEntry : contextEntries){
            String [] contextPair = contextEntry.split("=", 2);
            String contextKey = contextPair[0];
            String contextValue = contextPair[1];
            if(contextPair.length != 2 || contextKey.isEmpty() || contextValue.isEmpty()){
                throw new IllegalArgumentException(format("Context entry {0} is incomplete.", contextEntry));
            }
            contextMap.put(contextKey, contextValue);
        }
        return contextMap;
    }

    public void setContextEntries(List<String> contextEntries) {
        this.contextEntries = contextEntries;
    }

    public String getTakeScreenshots() {
        return takeScreenshots;
    }

    public void setTakeScreenshots(String takeScreenshots) {
        this.takeScreenshots = takeScreenshots;
    }

    public String getScreenshotPath() {
        return screenshotPath;
    }

    public void setScreenshotPath(String screenshotPath) {
        this.screenshotPath = screenshotPath;
    }

    public String getReportPath() {
        return reportPath;
    }

    public void setReportPath(String reportPath) {
        this.reportPath = reportPath;
    }

    public String getScenarioPattern() {
        return scenarioPattern;
    }

    public void setScenarioPattern(String scenarioPattern) {
        this.scenarioPattern = scenarioPattern;
    }

    public String getScreenshotType() {
		return screenshotType;
	}

	public void setScreenshotType(String screenshotType) {
		this.screenshotType = screenshotType;
	}

	public String getScreenshotFormat() {
		return screenshotFormat;
	}

	public void setScreenshotFormat(String screenshotFormat) {
		this.screenshotFormat = screenshotFormat;
	}

    public String getBrowserLogLevel() {
        return browserLogLevel;
    }

    public void setBrowserLogLevel(String browserLogLevel) {
        this.browserLogLevel = browserLogLevel;
    }

    public String getScenarioPath() {
        return scenarioPath;
    }

    public Collection<String> getAllScenarioPaths(){
        Set<String> scenarioPaths = new HashSet<>();
        String scenarioPath = getScenarioPath();
        if(!ConfigurationProperties.DEFAULT_SCENARIO_PATH.equals(scenarioPath)){
            scenarioPaths.add(scenarioPath);
        }
        scenarioPaths.addAll(getScenarioPaths());
        return scenarioPaths;
    }

    public void setScenarioPath(String scenarioPath) {
        this.scenarioPath = scenarioPath;
    }

    public String getMaximizeWindow() {
        return maximizeWindow;
    }

    public void setMaximizeWindow(String maximizeWindow) {
        this.maximizeWindow = maximizeWindow;
    }

    public String getMode() {
        return mode;
    }

    public boolean isInteractive(){
        return !DEFAULT_MODE.equals(mode);
    }

    public void setMode(String mode) {
        this.mode = mode;
    }
}


text:
import contextlib
import logging

from teuthology.orchestra import run

log = logging.getLogger(__name__)

@contextlib.contextmanager
def git_ignore_ssl(ctx, config):
    """
    Ignore ssl error's while cloning from untrusted http
    """

    log.info("ignoring ssl errors while cloning http repo")
    ctx.cluster.run(
            args=[
                  'sudo', 'git', 'config', run.Raw('--system'),
                  'http.sslverify', 'false'
                ],
        )
    yield


text:
/*
    Create multiple similar directives for watchOptions to support directiveControl
    instead. (when watches are disabled)
    NgAnnotate does not work here due to the functional creation
*/
['markers', 'geojson'].forEach(function(name) {
  angular.module('leaflet-directive').directive(name + 'WatchOptions', [
      '$log', '$rootScope', '$q', 'leafletData', 'leafletHelpers',
        function($log, $rootScope, $q, leafletData, leafletHelpers) {

          var isDefined = leafletHelpers.isDefined,
              errorHeader = leafletHelpers.errorHeader,
              isObject = leafletHelpers.isObject,
              _watchOptions = leafletHelpers.watchOptions;

          return {
            restrict: 'A',
            scope: false,
            replace: false,
            require: ['leaflet'],

            link: function(scope, element, attrs, controller) {
              var mapController = controller[0],
                  leafletScope = mapController.getLeafletScope();

              mapController.getMap().then(function() {
                if (isDefined(scope[name + 'WatchOptions'])) {
                  if (isObject(scope[name + 'WatchOptions']))
                      angular.extend(_watchOptions, scope[name + 'WatchOptions']);
                  else
                      $log.error(errorHeader + '[' + name + 'WatchOptions] is not an object');
                  leafletScope[name + 'WatchOptions'] = _watchOptions;
                }
              });
            },
          };
        }, ]);
});