text:
require 'date'
require 'google/apis/core/base_service'
require 'google/apis/core/json_representation'
require 'google/apis/core/hashable'
require 'google/apis/errors'

module Google
  module Apis
    module NetworkmanagementV1beta1

      class AbortInfo
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class AuditConfig
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class AuditLogConfig
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class Binding
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class CancelOperationRequest
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class CloudSqlInstanceInfo
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class ConnectivityTest
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class DeliverInfo
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class DropInfo
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class Empty
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class Endpoint
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class EndpointInfo
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class Expr
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class FirewallInfo
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class ForwardInfo
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class ForwardingRuleInfo
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class GkeMasterInfo
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class InstanceInfo
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class LatencyDistribution
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class LatencyPercentile
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class ListConnectivityTestsResponse
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class ListLocationsResponse
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class ListOperationsResponse
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class LoadBalancerBackend
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class LoadBalancerInfo
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class Location
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class NetworkInfo
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class Operation
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class OperationMetadata
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class Policy
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class ProbingDetails
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class ReachabilityDetails
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class RerunConnectivityTestRequest
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class RouteInfo
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class SetIamPolicyRequest
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class Status
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class Step
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class TestIamPermissionsRequest
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class TestIamPermissionsResponse
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class Trace
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class VpnGatewayInfo
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class VpnTunnelInfo
        class Representation < Google::Apis::Core::JsonRepresentation; end

        include Google::Apis::Core::JsonObjectSupport
      end

      class AbortInfo
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :cause, as: 'cause'
          property :resource_uri, as: 'resourceUri'
        end
      end

      class AuditConfig
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          collection :audit_log_configs, as: 'auditLogConfigs', class: Google::Apis::NetworkmanagementV1beta1::AuditLogConfig, decorator: Google::Apis::NetworkmanagementV1beta1::AuditLogConfig::Representation

          property :service, as: 'service'
        end
      end

      class AuditLogConfig
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          collection :exempted_members, as: 'exemptedMembers'
          property :log_type, as: 'logType'
        end
      end

      class Binding
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :binding_id, as: 'bindingId'
          property :condition, as: 'condition', class: Google::Apis::NetworkmanagementV1beta1::Expr, decorator: Google::Apis::NetworkmanagementV1beta1::Expr::Representation

          collection :members, as: 'members'
          property :role, as: 'role'
        end
      end

      class CancelOperationRequest
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
        end
      end

      class CloudSqlInstanceInfo
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :display_name, as: 'displayName'
          property :external_ip, as: 'externalIp'
          property :internal_ip, as: 'internalIp'
          property :network_uri, as: 'networkUri'
          property :region, as: 'region'
          property :uri, as: 'uri'
        end
      end

      class ConnectivityTest
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :create_time, as: 'createTime'
          property :description, as: 'description'
          property :destination, as: 'destination', class: Google::Apis::NetworkmanagementV1beta1::Endpoint, decorator: Google::Apis::NetworkmanagementV1beta1::Endpoint::Representation

          property :display_name, as: 'displayName'
          hash :labels, as: 'labels'
          property :name, as: 'name'
          property :probing_details, as: 'probingDetails', class: Google::Apis::NetworkmanagementV1beta1::ProbingDetails, decorator: Google::Apis::NetworkmanagementV1beta1::ProbingDetails::Representation

          property :protocol, as: 'protocol'
          property :reachability_details, as: 'reachabilityDetails', class: Google::Apis::NetworkmanagementV1beta1::ReachabilityDetails, decorator: Google::Apis::NetworkmanagementV1beta1::ReachabilityDetails::Representation

          collection :related_projects, as: 'relatedProjects'
          property :source, as: 'source', class: Google::Apis::NetworkmanagementV1beta1::Endpoint, decorator: Google::Apis::NetworkmanagementV1beta1::Endpoint::Representation

          property :update_time, as: 'updateTime'
        end
      end

      class DeliverInfo
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :resource_uri, as: 'resourceUri'
          property :target, as: 'target'
        end
      end

      class DropInfo
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :cause, as: 'cause'
          property :resource_uri, as: 'resourceUri'
        end
      end

      class Empty
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
        end
      end

      class Endpoint
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :cloud_sql_instance, as: 'cloudSqlInstance'
          property :gke_master_cluster, as: 'gkeMasterCluster'
          property :instance, as: 'instance'
          property :ip_address, as: 'ipAddress'
          property :network, as: 'network'
          property :network_type, as: 'networkType'
          property :port, as: 'port'
          property :project_id, as: 'projectId'
        end
      end

      class EndpointInfo
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :destination_ip, as: 'destinationIp'
          property :destination_network_uri, as: 'destinationNetworkUri'
          property :destination_port, as: 'destinationPort'
          property :protocol, as: 'protocol'
          property :source_ip, as: 'sourceIp'
          property :source_network_uri, as: 'sourceNetworkUri'
          property :source_port, as: 'sourcePort'
        end
      end

      class Expr
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :description, as: 'description'
          property :expression, as: 'expression'
          property :location, as: 'location'
          property :title, as: 'title'
        end
      end

      class FirewallInfo
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :action, as: 'action'
          property :direction, as: 'direction'
          property :display_name, as: 'displayName'
          property :network_uri, as: 'networkUri'
          property :priority, as: 'priority'
          collection :target_service_accounts, as: 'targetServiceAccounts'
          collection :target_tags, as: 'targetTags'
          property :uri, as: 'uri'
        end
      end

      class ForwardInfo
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :resource_uri, as: 'resourceUri'
          property :target, as: 'target'
        end
      end

      class ForwardingRuleInfo
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :display_name, as: 'displayName'
          property :matched_port_range, as: 'matchedPortRange'
          property :matched_protocol, as: 'matchedProtocol'
          property :network_uri, as: 'networkUri'
          property :target, as: 'target'
          property :uri, as: 'uri'
          property :vip, as: 'vip'
        end
      end

      class GkeMasterInfo
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :cluster_network_uri, as: 'clusterNetworkUri'
          property :cluster_uri, as: 'clusterUri'
          property :external_ip, as: 'externalIp'
          property :internal_ip, as: 'internalIp'
        end
      end

      class InstanceInfo
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :display_name, as: 'displayName'
          property :external_ip, as: 'externalIp'
          property :interface, as: 'interface'
          property :internal_ip, as: 'internalIp'
          collection :network_tags, as: 'networkTags'
          property :network_uri, as: 'networkUri'
          property :service_account, as: 'serviceAccount'
          property :uri, as: 'uri'
        end
      end

      class LatencyDistribution
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          collection :latency_percentiles, as: 'latencyPercentiles', class: Google::Apis::NetworkmanagementV1beta1::LatencyPercentile, decorator: Google::Apis::NetworkmanagementV1beta1::LatencyPercentile::Representation

        end
      end

      class LatencyPercentile
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :latency_micros, :numeric_string => true, as: 'latencyMicros'
          property :percent, as: 'percent'
        end
      end

      class ListConnectivityTestsResponse
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :next_page_token, as: 'nextPageToken'
          collection :resources, as: 'resources', class: Google::Apis::NetworkmanagementV1beta1::ConnectivityTest, decorator: Google::Apis::NetworkmanagementV1beta1::ConnectivityTest::Representation

          collection :unreachable, as: 'unreachable'
        end
      end

      class ListLocationsResponse
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          collection :locations, as: 'locations', class: Google::Apis::NetworkmanagementV1beta1::Location, decorator: Google::Apis::NetworkmanagementV1beta1::Location::Representation

          property :next_page_token, as: 'nextPageToken'
        end
      end

      class ListOperationsResponse
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :next_page_token, as: 'nextPageToken'
          collection :operations, as: 'operations', class: Google::Apis::NetworkmanagementV1beta1::Operation, decorator: Google::Apis::NetworkmanagementV1beta1::Operation::Representation

        end
      end

      class LoadBalancerBackend
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :display_name, as: 'displayName'
          collection :health_check_allowing_firewall_rules, as: 'healthCheckAllowingFirewallRules'
          collection :health_check_blocking_firewall_rules, as: 'healthCheckBlockingFirewallRules'
          property :health_check_firewall_state, as: 'healthCheckFirewallState'
          property :uri, as: 'uri'
        end
      end

      class LoadBalancerInfo
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :backend_type, as: 'backendType'
          property :backend_uri, as: 'backendUri'
          collection :backends, as: 'backends', class: Google::Apis::NetworkmanagementV1beta1::LoadBalancerBackend, decorator: Google::Apis::NetworkmanagementV1beta1::LoadBalancerBackend::Representation

          property :health_check_uri, as: 'healthCheckUri'
          property :load_balancer_type, as: 'loadBalancerType'
        end
      end

      class Location
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :display_name, as: 'displayName'
          hash :labels, as: 'labels'
          property :location_id, as: 'locationId'
          hash :metadata, as: 'metadata'
          property :name, as: 'name'
        end
      end

      class NetworkInfo
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :display_name, as: 'displayName'
          property :matched_ip_range, as: 'matchedIpRange'
          property :uri, as: 'uri'
        end
      end

      class Operation
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :done, as: 'done'
          property :error, as: 'error', class: Google::Apis::NetworkmanagementV1beta1::Status, decorator: Google::Apis::NetworkmanagementV1beta1::Status::Representation

          hash :metadata, as: 'metadata'
          property :name, as: 'name'
          hash :response, as: 'response'
        end
      end

      class OperationMetadata
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :api_version, as: 'apiVersion'
          property :cancel_requested, as: 'cancelRequested'
          property :create_time, as: 'createTime'
          property :end_time, as: 'endTime'
          property :status_detail, as: 'statusDetail'
          property :target, as: 'target'
          property :verb, as: 'verb'
        end
      end

      class Policy
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          collection :audit_configs, as: 'auditConfigs', class: Google::Apis::NetworkmanagementV1beta1::AuditConfig, decorator: Google::Apis::NetworkmanagementV1beta1::AuditConfig::Representation

          collection :bindings, as: 'bindings', class: Google::Apis::NetworkmanagementV1beta1::Binding, decorator: Google::Apis::NetworkmanagementV1beta1::Binding::Representation

          property :etag, :base64 => true, as: 'etag'
          property :version, as: 'version'
        end
      end

      class ProbingDetails
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :abort_cause, as: 'abortCause'
          property :endpoint_info, as: 'endpointInfo', class: Google::Apis::NetworkmanagementV1beta1::EndpointInfo, decorator: Google::Apis::NetworkmanagementV1beta1::EndpointInfo::Representation

          property :error, as: 'error', class: Google::Apis::NetworkmanagementV1beta1::Status, decorator: Google::Apis::NetworkmanagementV1beta1::Status::Representation

          property :probing_latency, as: 'probingLatency', class: Google::Apis::NetworkmanagementV1beta1::LatencyDistribution, decorator: Google::Apis::NetworkmanagementV1beta1::LatencyDistribution::Representation

          property :result, as: 'result'
          property :sent_probe_count, as: 'sentProbeCount'
          property :successful_probe_count, as: 'successfulProbeCount'
          property :verify_time, as: 'verifyTime'
        end
      end

      class ReachabilityDetails
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :error, as: 'error', class: Google::Apis::NetworkmanagementV1beta1::Status, decorator: Google::Apis::NetworkmanagementV1beta1::Status::Representation

          property :result, as: 'result'
          collection :traces, as: 'traces', class: Google::Apis::NetworkmanagementV1beta1::Trace, decorator: Google::Apis::NetworkmanagementV1beta1::Trace::Representation

          property :verify_time, as: 'verifyTime'
        end
      end

      class RerunConnectivityTestRequest
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
        end
      end

      class RouteInfo
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :dest_ip_range, as: 'destIpRange'
          property :display_name, as: 'displayName'
          collection :instance_tags, as: 'instanceTags'
          property :network_uri, as: 'networkUri'
          property :next_hop, as: 'nextHop'
          property :next_hop_type, as: 'nextHopType'
          property :priority, as: 'priority'
          property :route_type, as: 'routeType'
          property :uri, as: 'uri'
        end
      end

      class SetIamPolicyRequest
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :policy, as: 'policy', class: Google::Apis::NetworkmanagementV1beta1::Policy, decorator: Google::Apis::NetworkmanagementV1beta1::Policy::Representation

          property :update_mask, as: 'updateMask'
        end
      end

      class Status
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :code, as: 'code'
          collection :details, as: 'details'
          property :message, as: 'message'
        end
      end

      class Step
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :abort, as: 'abort', class: Google::Apis::NetworkmanagementV1beta1::AbortInfo, decorator: Google::Apis::NetworkmanagementV1beta1::AbortInfo::Representation

          property :causes_drop, as: 'causesDrop'
          property :cloud_sql_instance, as: 'cloudSqlInstance', class: Google::Apis::NetworkmanagementV1beta1::CloudSqlInstanceInfo, decorator: Google::Apis::NetworkmanagementV1beta1::CloudSqlInstanceInfo::Representation

          property :deliver, as: 'deliver', class: Google::Apis::NetworkmanagementV1beta1::DeliverInfo, decorator: Google::Apis::NetworkmanagementV1beta1::DeliverInfo::Representation

          property :description, as: 'description'
          property :drop, as: 'drop', class: Google::Apis::NetworkmanagementV1beta1::DropInfo, decorator: Google::Apis::NetworkmanagementV1beta1::DropInfo::Representation

          property :endpoint, as: 'endpoint', class: Google::Apis::NetworkmanagementV1beta1::EndpointInfo, decorator: Google::Apis::NetworkmanagementV1beta1::EndpointInfo::Representation

          property :firewall, as: 'firewall', class: Google::Apis::NetworkmanagementV1beta1::FirewallInfo, decorator: Google::Apis::NetworkmanagementV1beta1::FirewallInfo::Representation

          property :forward, as: 'forward', class: Google::Apis::NetworkmanagementV1beta1::ForwardInfo, decorator: Google::Apis::NetworkmanagementV1beta1::ForwardInfo::Representation

          property :forwarding_rule, as: 'forwardingRule', class: Google::Apis::NetworkmanagementV1beta1::ForwardingRuleInfo, decorator: Google::Apis::NetworkmanagementV1beta1::ForwardingRuleInfo::Representation

          property :gke_master, as: 'gkeMaster', class: Google::Apis::NetworkmanagementV1beta1::GkeMasterInfo, decorator: Google::Apis::NetworkmanagementV1beta1::GkeMasterInfo::Representation

          property :instance, as: 'instance', class: Google::Apis::NetworkmanagementV1beta1::InstanceInfo, decorator: Google::Apis::NetworkmanagementV1beta1::InstanceInfo::Representation

          property :load_balancer, as: 'loadBalancer', class: Google::Apis::NetworkmanagementV1beta1::LoadBalancerInfo, decorator: Google::Apis::NetworkmanagementV1beta1::LoadBalancerInfo::Representation

          property :network, as: 'network', class: Google::Apis::NetworkmanagementV1beta1::NetworkInfo, decorator: Google::Apis::NetworkmanagementV1beta1::NetworkInfo::Representation

          property :project_id, as: 'projectId'
          property :route, as: 'route', class: Google::Apis::NetworkmanagementV1beta1::RouteInfo, decorator: Google::Apis::NetworkmanagementV1beta1::RouteInfo::Representation

          property :state, as: 'state'
          property :vpn_gateway, as: 'vpnGateway', class: Google::Apis::NetworkmanagementV1beta1::VpnGatewayInfo, decorator: Google::Apis::NetworkmanagementV1beta1::VpnGatewayInfo::Representation

          property :vpn_tunnel, as: 'vpnTunnel', class: Google::Apis::NetworkmanagementV1beta1::VpnTunnelInfo, decorator: Google::Apis::NetworkmanagementV1beta1::VpnTunnelInfo::Representation

        end
      end

      class TestIamPermissionsRequest
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          collection :permissions, as: 'permissions'
        end
      end

      class TestIamPermissionsResponse
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          collection :permissions, as: 'permissions'
        end
      end

      class Trace
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :endpoint_info, as: 'endpointInfo', class: Google::Apis::NetworkmanagementV1beta1::EndpointInfo, decorator: Google::Apis::NetworkmanagementV1beta1::EndpointInfo::Representation

          collection :steps, as: 'steps', class: Google::Apis::NetworkmanagementV1beta1::Step, decorator: Google::Apis::NetworkmanagementV1beta1::Step::Representation

        end
      end

      class VpnGatewayInfo
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :display_name, as: 'displayName'
          property :ip_address, as: 'ipAddress'
          property :network_uri, as: 'networkUri'
          property :region, as: 'region'
          property :uri, as: 'uri'
          property :vpn_tunnel_uri, as: 'vpnTunnelUri'
        end
      end

      class VpnTunnelInfo
        # @private
        class Representation < Google::Apis::Core::JsonRepresentation
          property :display_name, as: 'displayName'
          property :network_uri, as: 'networkUri'
          property :region, as: 'region'
          property :remote_gateway, as: 'remoteGateway'
          property :remote_gateway_ip, as: 'remoteGatewayIp'
          property :routing_type, as: 'routingType'
          property :source_gateway, as: 'sourceGateway'
          property :source_gateway_ip, as: 'sourceGatewayIp'
          property :uri, as: 'uri'
        end
      end
    end
  end
end


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Altus.Suffūz.Observables
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
    public abstract class ConflictingEventAttribute : Attribute
    {
        protected ConflictingEventAttribute() { }

        public Type ConflictHandlerType { get; protected set; }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta name="description" content="Stichting Hart voor Internetvrijheid is een organisatie die zich in zet voor privacy en publicatievrijheid online door het ondersteunen van netwerkinfratrustuur zoals het Tor netwerk.">
    <meta name="author" content="Hart voor Internetvrijheid">

    <title>Hart voor Internetvrijheid</title>

    <link href="./dist/css/bootstrap.css" rel="stylesheet">

    <link href="jumbotron-narrow.css" rel="stylesheet">

Home

English

Over ons

Donaties

Contact

Hart voor Internetvrijheid

English

Hart voor Internetvrijheid (Heart for Internetfreedom) is a not-for-profit foundation registered in the Netherlands. Our mission is freedom on the internet. We do this by stimulating the use of technology that has a positive impact on the online freedom of speech and anonymity and which allows for circumvention of censorship.

Contact

For general inquiries, send an e-mail to the foundation's board of members at bestuur@hartvoorinternetvrijheid.nl.

If you had some issue with the traffic coming from one of our Tor-nodes, please get in touch with abuse@hartvoorinternetvrijheid.nl.

Copyleft Hart voor Internetvrijheid 2013


text:
<!--
Description: Chi
Expect:      bozo and feed['title'] == u'testing \u03a7 entity'
-->
<rss>
<channel>
<title>testing Χ entity</title>
</channel>
</rss>


text:
<?php

/**
 * CActiveDataProvider implements a data provider based on ActiveRecord.
 *
 * CActiveDataProvider provides data in terms of ActiveRecord objects which are
 * of class {@link modelClass}. It uses the AR {@link CActiveRecord::findAll} method
 * to retrieve the data from database. The {@link criteria} property can be used to
 * specify various query options.
 *
 * CActiveDataProvider may be used in the following way:
 *

 * $dataProvider=new CActiveDataProvider('Post', array(
 *     'criteria'=>array(
 *         'condition'=>'status=1',
 *         'order'=>'create_time DESC',
 *         'with'=>array('author'),
 *     ),
 *     'countCriteria'=>array(
 *         'condition'=>'status=1',
 *         // 'order' and 'with' clauses have no meaning for the count query
 *     ),
 *     'pagination'=>array(
 *         'pageSize'=>20,
 *     ),
 * ));
 * // $dataProvider->getData() will return a list of Post objects
 *

 *
 * @property CDbCriteria $criteria The query criteria.
 * @property CDbCriteria $countCriteria The count query criteria. This property is available
 * since 1.1.14
 * @property CSort $sort The sorting object. If this is false, it means the sorting is disabled.
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @package system.web
 * @since 1.1
 */
class CActiveDataProvider extends CDataProvider
{
	/**
	 * @var string the primary ActiveRecord class name. The {@link getData()} method
	 * will return a list of objects of this class.
	 */
	public $modelClass;
	/**
	 * @var CActiveRecord the AR finder instance (eg Post::model()).
	 * This property can be set by passing the finder instance as the first parameter
	 * to the constructor. For example, Post::model()->published().
	 * @since 1.1.3
	 */
	public $model;
	/**
	 * @var string the name of key attribute for {@link modelClass}. If not set,
	 * it means the primary key of the corresponding database table will be used.
	 */
	public $keyAttribute;

	/**
	 * @var CDbCriteria
	 */
	private $_criteria;
	/**
	 * @var CDbCriteria
	 */
	private $_countCriteria;

	/**
	 * Constructor.
	 * @param mixed $modelClass the model class (e.g. 'Post') or the model finder instance
	 * (e.g. Post::model(), Post::model()->published()).
	 * @param array $config configuration (name=>value) to be applied as the initial property values of this class.
	 */
	public function __construct($modelClass,$config=array())
	{
		if(is_string($modelClass))
		{
			$this->modelClass=$modelClass;
			$this->model=$this->getModel($this->modelClass);
		}
		elseif($modelClass instanceof CActiveRecord)
		{
			$this->modelClass=get_class($modelClass);
			$this->model=$modelClass;
		}
		$this->setId(CHtml::modelName($this->model));
		foreach($config as $key=>$value)
			$this->$key=$value;
	}

	/**
	 * Returns the query criteria.
	 * @return CDbCriteria the query criteria
	 */
	public function getCriteria()
	{
		if($this->_criteria===null)
			$this->_criteria=new CDbCriteria;
		return $this->_criteria;
	}

	/**
	 * Sets the query criteria.
	 * @param CDbCriteria|array $value the query criteria. This can be either a CDbCriteria object or an array
	 * representing the query criteria.
	 */
	public function setCriteria($value)
	{
		$this->_criteria=$value instanceof CDbCriteria ? $value : new CDbCriteria($value);
	}

	/**
	 * Returns the count query criteria.
	 * @return CDbCriteria the count query criteria.
	 * @since 1.1.14
	 */
	public function getCountCriteria()
	{
		if($this->_countCriteria===null)
			return $this->getCriteria();
		return $this->_countCriteria;
	}

	/**
	 * Sets the count query criteria.
	 * @param CDbCriteria|array $value the count query criteria. This can be either a CDbCriteria object
	 * or an array representing the query criteria.
	 * @since 1.1.14
	 */
	public function setCountCriteria($value)
	{
		$this->_countCriteria=$value instanceof CDbCriteria ? $value : new CDbCriteria($value);
	}

	/**
	 * Returns the sorting object.
	 * @param string $className the sorting object class name. Parameter is available since version 1.1.13.
	 * @return CSort the sorting object. If this is false, it means the sorting is disabled.
	 */
	public function getSort($className='CSort')
	{
		if(($sort=parent::getSort($className))!==false)
			$sort->modelClass=$this->modelClass;
		return $sort;
	}

	/**
	 * Given active record class name returns new model instance.
	 *
	 * @param string $className active record class name.
	 * @return CActiveRecord active record model instance.
	 *
	 * @since 1.1.14
	 */
	protected function getModel($className)
	{
		return CActiveRecord::model($className);
	}

	/**
	 * Fetches the data from the persistent data storage.
	 * @return array list of data items
	 */
	protected function fetchData()
	{
		$criteria=clone $this->getCriteria();

		if(($pagination=$this->getPagination())!==false)
		{
			$pagination->setItemCount($this->getTotalItemCount());
			$pagination->applyLimit($criteria);
		}

		$baseCriteria=$this->model->getDbCriteria(false);

		if(($sort=$this->getSort())!==false)
		{
			// set model criteria so that CSort can use its table alias setting
			if($baseCriteria!==null)
			{
				$c=clone $baseCriteria;
				$c->mergeWith($criteria);
				$this->model->setDbCriteria($c);
			}
			else
				$this->model->setDbCriteria($criteria);
			$sort->applyOrder($criteria);
		}

		$this->model->setDbCriteria($baseCriteria!==null ? clone $baseCriteria : null);
		$data=$this->model->findAll($criteria);
		$this->model->setDbCriteria($baseCriteria);  // restore original criteria
		return $data;
	}

	/**
	 * Fetches the data item keys from the persistent data storage.
	 * @return array list of data item keys.
	 */
	protected function fetchKeys()
	{
		$keys=array();
		foreach($this->getData() as $i=>$data)
		{
			$key=$this->keyAttribute===null ? $data->getPrimaryKey() : $data->{$this->keyAttribute};
			$keys[$i]=is_array($key) ? implode(',',$key) : $key;
		}
		return $keys;
	}

	/**
	 * Calculates the total number of data items.
	 * @return integer the total number of data items.
	 */
	protected function calculateTotalItemCount()
	{
		$baseCriteria=$this->model->getDbCriteria(false);
		if($baseCriteria!==null)
			$baseCriteria=clone $baseCriteria;
		$count=$this->model->count($this->getCountCriteria());
		$this->model->setDbCriteria($baseCriteria);
		return $count;
	}
}


text:
package org.neo4j.cypher.internal.compiler.v2_3.planner.logical.plans

import org.neo4j.cypher.internal.frontend.v2_3.{SemanticDirection, ast}
import org.neo4j.cypher.internal.frontend.v2_3.ast.RelTypeName
import org.neo4j.cypher.internal.frontend.v2_3.perty.PageDocFormatting

final case class PatternRelationship(name: IdName, nodes: (IdName, IdName), dir: SemanticDirection,
                                     types: Seq[RelTypeName], length: PatternLength)
  extends PageDocFormatting { // with ToPrettyString[PatternRelationship] {

//  def toDefaultPrettyString(formatter: DocFormatter) =
//    toPrettyString(formatter)(InternalDocHandler.docGen)

  def directionRelativeTo(node: IdName): SemanticDirection = if (node == left) dir else dir.reversed

  def otherSide(node: IdName) = if (node == left) right else left

  def coveredIds: Set[IdName] = Set(name, left, right)

  def left = nodes._1

  def right = nodes._2

  def inOrder = dir match {
    case SemanticDirection.INCOMING => (right, left)
    case _ => (left, right)
  }
}

object PatternRelationship {
  implicit val byName = Ordering.by { (patternRel: PatternRelationship) => patternRel.name }
}

// TODO: Remove ast representation
final case class ShortestPathPattern(name: Option[IdName], rel: PatternRelationship, single: Boolean)(val expr: ast.ShortestPaths)
  extends PageDocFormatting { // with ToPrettyString[ShortestPathPattern] {

//  def toDefaultPrettyString(formatter: DocFormatter) =
//    toPrettyString(formatter)(InternalDocHandler.docGen)

  def isFindableFrom(symbols: Set[IdName]) = symbols.contains(rel.left) && symbols.contains(rel.right)

  def availableSymbols: Set[IdName] = name.toSet ++ rel.coveredIds
}

object ShortestPathPattern {
  implicit val byRelName = Ordering.by { (sp: ShortestPathPattern) => sp.rel }
}

trait PatternLength extends PageDocFormatting { // with ToPrettyString[PatternLength] {

//  def toDefaultPrettyString(formatter: DocFormatter) =
//    toPrettyString(formatter)(InternalDocHandler.docGen)

  def implicitPatternNodeCount: Int
  def isSimple: Boolean
}

case object SimplePatternLength extends PatternLength {
  def isSimple = true

  def implicitPatternNodeCount: Int = 0
}

final case class VarPatternLength(min: Int, max: Option[Int]) extends PatternLength {
  def isSimple = false

  def implicitPatternNodeCount = max.getOrElse(VarPatternLength.STAR_LENGTH)
}

object VarPatternLength {
  val STAR_LENGTH = 16

  def unlimited = VarPatternLength(1, None)

  def fixed(length: Int) = VarPatternLength(length, Some(length))
}


text:
The *Predict Protocol, version 2* is a set of HTTP/REST and GRPC APIs
for inference / prediction servers. By implementing this protocol both
inference clients and servers will increase their utility and
portability by being able to operate seamlessly on platforms that have
standardized around this protocol.

The protocol is composed of a required set of APIs that must be
implemented by a compliant server. This required set of APIs is
described in [required_api.md](./required_api.md). The [GRPC proto
specification](grpc_predict_v2.proto)
for the required APIs is available.

The protocol supports an extension mechanism as a required part of the
API, but no specific extensions are required to be implemented by a
compliant server. Inference servers that have implemented extensions
and the link to those extensions are:

- Triton Inference Server:
  https://github.com/triton-inference-server/server/tree/master/docs/protocol

The protocol is not yet finalized and so feedback is welcome. To
provide feedback open an issue and prepend the title with "[Predict
Protocol V2]".


text:
<?php

namespace yii\web;

use Yii;
use yii\base\InlineAction;
use yii\helpers\HtmlPurifier;
use yii\helpers\Url;

/**
 * Controller is the base class of web controllers.
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since 2.0
 */
class Controller extends \yii\base\Controller
{
    /**
     * @var boolean whether to enable CSRF validation for the actions in this controller.
     * CSRF validation is enabled only when both this property and [[Request::enableCsrfValidation]] are true.
     */
    public $enableCsrfValidation = true;
    /**
     * @var array the parameters bound to the current action.
     */
    public $actionParams = [];

    /**
     * 错误消息提示
     * @param unknown $msg
     * @param string $url
     * @param number $timeout
     */
    public function error($msg, $url = '', $timeout = 3, $script = '')
    {
        $this->pushMsg('err', $msg, $url, $timeout);
    }

    /**
     * 正确消息提示
     * @param unknown $msg
     * @param string $url
     * @param number $timeout
     */
    public function success($msg, $url = '', $timeout = 3, $script = '')
    {
        $this->pushMsg('ok', $msg, $url, $timeout);
    }

    /**
     * 普通消息提示
     * @param unknown $msg
     * @param string $url
     * @param number $timeout
     */
    public function info($msg, $url = '', $timeout = 3, $script = '')
    {
        $this->pushMsg('info', $msg, $url, $timeout, $script);
    }

    /**
     * 提示消息并重定向
     * @param  string $type 消息类型, 成功success,错误error,信息info,
     * @param  string $message 显示的消息
     * @param  string $url     跳转的URL
     * @param  integer $delay   跳转间隔
     * @param  string $script  要执行的JS脚本
     */
    public function redirectMessage($type='info', $message, $url='', $delay=3, $script='')
    {
        if(empty($url)){
            $url = HtmlPurifier::process(Yii::$app->request->Referrer);
        }

        return $this->render('//site/error', array(
            'type'=>$type,
            'message'=>$message,
            'url'=>$url,
            'delay'=>$delay,
            'script'=>''
        ));
        exit;
    }

    /**
     * 统一消息提示
     * @param unknown $type
     * @param unknown $msg
     * @param string $url
     * @param number $timeout
     */
    public function pushMsg($type, $msg, $url = '', $timeout = 3, $script = '')
    {
        $this->layout = "/main";
        if (Yii::$app->request->isAjax) {
            $return = array(
                'info' => $type,
                'data' => (array) $msg
            );
            echo json_encode($return);
            Yii::$app->end();
        }

        if(empty($url)){
            $url = HtmlPurifier::process(Yii::$app->request->Referrer);
        }
        echo $this->render('//site/error',[
            'type'=>$type,
            'message'=>$msg,
            'url'=>$url,
            'delay'=>$timeout,
            'script'=>$script
        ]);
        exit;
    }

    private function userStatus($action)
    {
        $isGuest = Yii::$app->user->isGuest;
        if(!$isGuest) {
            $uid = Yii::$app->user->id;
            $userModel = RegistryUser::findOne($uid);
            $error = false;

            if(!empty($userModel)){
                if ($userModel->deleted == '是' || $userModel->status != '正常') {
                    $error = true;
                }
            }else{
                $error = true;
            }

            if($error && in_array($action->id, array('login','logout')) == false){
                return $this->redirect('/site/logout');
                Yii::$app->end();
            }
        }
        return true;
    }

    private function checkfunction($action)
    {
        $controller_id = $this->getUniqueId();
        $action_id = $action->id;
        if (!in_array($controller_id, $this->_outcontroller)) {
            $uid = Yii::$app->user->id;
            if(empty($uid)) return $this->redirect('/user/login');
            $function = AuthFunction::findOne(['platform' => '注册局' , 'controller' => $controller_id, 'action' => $action_id]);
            if (empty($function)) {
                $this->error('你访问的控制器方法不存在,请联系管理员添加此action');
                Yii::$app->end();
            }
            $sql = "SELECT mf.function_id FROM auth_user_role uf
						INNER JOIN  auth_role f ON f.id = uf.role_id
						INNER JOIN  auth_role_menu rm ON f.id = rm.role_id
						INNER JOIN  auth_menu_function mf ON rm.menu_id = mf.menu_id
						WHERE uf.user_id = {$uid}";
            $db = Yii::$app->db->createCommand ( $sql );
            $result = $db->queryColumn ();
            if (!empty($result)) {
                if (in_array($function->id, $result)) {
                    return true;
                }
            }
            $this->error("你无权查看此控制器方法: {$controller_id}/{$action_id}");
            Yii::$app->end();
        }
        return true;
    }

    /**
     * Renders a view in response to an AJAX request.
     *
     * This method is similar to [[renderPartial()]] except that it will inject into
     * the rendering result with JS/CSS scripts and files which are registered with the view.
     * For this reason, you should use this method instead of [[renderPartial()]] to render
     * a view to respond to an AJAX request.
     *
     * @param string $view the view name. Please refer to [[render()]] on how to specify a view name.
     * @param array $params the parameters (name-value pairs) that should be made available in the view.
     * @return string the rendering result.
     */
    public function renderAjax($view, $params = [])
    {
        return $this->getView()->renderAjax($view, $params, $this);
    }

    /**
     * Binds the parameters to the action.
     * This method is invoked by [[\yii\base\Action]] when it begins to run with the given parameters.
     * This method will check the parameter names that the action requires and return
     * the provided parameters according to the requirement. If there is any missing parameter,
     * an exception will be thrown.
     * @param \yii\base\Action $action the action to be bound with parameters
     * @param array $params the parameters to be bound to the action
     * @return array the valid parameters that the action can run with.
     * @throws BadRequestHttpException if there are missing or invalid parameters.
     */
    public function bindActionParams($action, $params)
    {
        if ($action instanceof InlineAction) {
            $method = new \ReflectionMethod($this, $action->actionMethod);
        } else {
            $method = new \ReflectionMethod($action, 'run');
        }

        $args = [];
        $missing = [];
        $actionParams = [];
        foreach ($method->getParameters() as $param) {
            $name = $param->getName();
            if (array_key_exists($name, $params)) {
                if ($param->isArray()) {
                    $args[] = $actionParams[$name] = (array) $params[$name];
                } elseif (!is_array($params[$name])) {
                    $args[] = $actionParams[$name] = $params[$name];
                } else {
                    throw new BadRequestHttpException(Yii::t('yii', 'Invalid data received for parameter "{param}".', [
                        'param' => $name,
                    ]));
                }
                unset($params[$name]);
            } elseif ($param->isDefaultValueAvailable()) {
                $args[] = $actionParams[$name] = $param->getDefaultValue();
            } else {
                $missing[] = $name;
            }
        }

        if (!empty($missing)) {
            throw new BadRequestHttpException(Yii::t('yii', 'Missing required parameters: {params}', [
                'params' => implode(', ', $missing),
            ]));
        }

        $this->actionParams = $actionParams;

        return $args;
    }

    /**
     * @inheritdoc
     */
    public function beforeAction($action)
    {
        if (parent::beforeAction($action)) {
            if ($this->enableCsrfValidation && Yii::$app->getErrorHandler()->exception === null && !Yii::$app->getRequest()->validateCsrfToken()) {
                throw new BadRequestHttpException(Yii::t('yii', 'Unable to verify your data submission.'));
            }
            return true;
        }

        return false;
    }

    /**
     * Redirects the browser to the specified URL.
     * This method is a shortcut to [[Response::redirect()]].
     *
     * You can use it in an action by returning the [[Response]] directly:
     *
     * ```php
     * // stop executing this action and redirect to login page
     * return $this->redirect(['login']);
     * ```
     *
     * @param string|array $url the URL to be redirected to. This can be in one of the following formats:
     *
     * - a string representing a URL (e.g. "http://example.com")
     * - a string representing a URL alias (e.g. "@example.com")
     * - an array in the format of `[$route, ...name-value pairs...]` (e.g. `['site/index', 'ref' => 1]`)
     *   [[Url::to()]] will be used to convert the array into a URL.
     *
     * Any relative URL will be converted into an absolute one by prepending it with the host info
     * of the current request.
     *
     * @param integer $statusCode the HTTP status code. Defaults to 302.
     * See <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html>
     * for details about HTTP status code
     * @return Response the current response object
     */
    public function redirect($url, $statusCode = 302)
    {
        return Yii::$app->getResponse()->redirect(Url::to($url), $statusCode);
    }

    /**
     * Redirects the browser to the home page.
     *
     * You can use this method in an action by returning the [[Response]] directly:
     *
     * ```php
     * // stop executing this action and redirect to home page
     * return $this->goHome();
     * ```
     *
     * @return Response the current response object
     */
    public function goHome()
    {
        return Yii::$app->getResponse()->redirect(Yii::$app->getHomeUrl());
    }

    /**
     * Redirects the browser to the last visited page.
     *
     * You can use this method in an action by returning the [[Response]] directly:
     *
     * ```php
     * // stop executing this action and redirect to last visited page
     * return $this->goBack();
     * ```
     *
     * For this function to work you have to [[User::setReturnUrl()|set the return URL]] in appropriate places before.
     *
     * @param string|array $defaultUrl the default return URL in case it was not set previously.
     * If this is null and the return URL was not set previously, [[Application::homeUrl]] will be redirected to.
     * Please refer to [[User::setReturnUrl()]] on accepted format of the URL.
     * @return Response the current response object
     * @see User::getReturnUrl()
     */
    public function goBack($defaultUrl = null)
    {
        return Yii::$app->getResponse()->redirect(Yii::$app->getUser()->getReturnUrl($defaultUrl));
    }

    /**
     * Refreshes the current page.
     * This method is a shortcut to [[Response::refresh()]].
     *
     * You can use it in an action by returning the [[Response]] directly:
     *
     * ```php
     * // stop executing this action and refresh the current page
     * return $this->refresh();
     * ```
     *
     * @param string $anchor the anchor that should be appended to the redirection URL.
     * Defaults to empty. Make sure the anchor starts with '#' if you want to specify it.
     * @return Response the response object itself
     */
    public function refresh($anchor = '')
    {
        return Yii::$app->getResponse()->redirect(Yii::$app->getRequest()->getUrl() . $anchor);
    }
}


text:
__docformat__='restructuredtext'

# Migration number: 063
# Cache-friendly

migration = [
    ("""
	ALTER TABLE users DROP COLUMN theme;
    ALTER TABLE widgets RENAME widget_template TO template;
    ALTER TABLE widgets RENAME widget_theme TO theme;
    ALTER TABLE widgets DROP CONSTRAINT widgets_pk;
    ALTER TABLE widgets DROP CONSTRAINT widgets_users_fk;
    ALTER TABLE widgets ALTER COLUMN id TYPE INTEGER;
    UPDATE widgets SET id = 1;
    ALTER TABLE widgets ADD CONSTRAINT widgets_pk PRIMARY KEY (id, user_id);
    ALTER TABLE widgets ADD CONSTRAINT widgets_user_fk FOREIGN KEY(user_id)
                                        REFERENCES users (id) ON DELETE cascade;
    ALTER TABLE widgets ALTER COLUMN id DROP DEFAULT;

     """,
     """
    CREATE TABLE widgets_tmp
    (
        id serial NOT NULL,
        user_id int4 NOT NULL,
        widget_template varchar(50),
        widget_theme varchar(16),
        best_referrer varchar(255),
        last_seen timestamp
    );

    INSERT INTO widgets_tmp (user_id, widget_template, widget_theme, best_referrer, last_seen)
     SELECT user_id, template, theme, best_referrer, last_seen FROM widgets;

    DROP TABLE widgets;
    ALTER TABLE widgets_tmp RENAME TO widgets;

    ALTER TABLE widgets ADD CONSTRAINT widgets_pk PRIMARY KEY (id);
    ALTER TABLE widgets ADD CONSTRAINT widgets_users_fk FOREIGN KEY (user_id)
        REFERENCES users (id) MATCH SIMPLE
            ON UPDATE NO ACTION ON DELETE NO ACTION;

	ALTER TABLE users ADD COLUMN theme VARCHAR(32);
     """),
]


text:
import serial

connected = False

ser = serial.Serial("/dev/tty.usbmodem411", 9600)

## loop

while not connected:
    serin = ser.read()
    connected = True

ser.write("1")

## done

while ser.read() == '1':
    ser.read()
    ser.close()


text:
// OPAlertOperation.m
// Copyright (c) 2015 Tom Wilson <tom@toms-stuff.net>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#if TARGET_OS_IPHONE

#import "OPAlertOperation.h"
#import "OPOperationConditionMutuallyExclusive.h"

@interface OPAlertOperation ()

@property (strong, nonatomic) UIAlertController *alertController;

@property (strong, nonatomic) UIViewController *presentationContext;

@end

@implementation OPAlertOperation

#pragma mark - Add Action
#pragma mark -

- (void)addAction:(NSString *)title
            style:(UIAlertActionStyle)style
          handler:(void (^)(OPAlertOperation *alertOperation))handler;
{
    __weak __typeof__(self) weakSelf = self;
    UIAlertAction *action = [UIAlertAction actionWithTitle:title style:style handler:^(UIAlertAction *action) {
        __typeof__(self) strongSelf = weakSelf;

        if (handler) {
            handler(strongSelf);
        }

        [strongSelf finish];
    }];

    [self.alertController addAction:action];
}

#pragma mark - Overrides
#pragma mark -

- (void)execute
{
    if (![self presentationContext]) {
        [self finish];
        return;
    }

    dispatch_async(dispatch_get_main_queue(), ^{
        if([self isCancelled]) {
            return;
        }

        if ([self.alertController.actions count] == 0) {
            [self addAction:@"OK" style:UIAlertActionStyleDefault handler:nil];
        }

        [self.presentationContext presentViewController:[self alertController] animated:YES completion:nil];
    });
}

- (void)cancel
{
    dispatch_async(dispatch_get_main_queue(), ^{
        if(self.alertController.presentingViewController)
        {
            [self.alertController dismissViewControllerAnimated:YES completion:^{
                [super cancel];
            }];
        }
        else
        {
            [super cancel];
        }
    });
}

#pragma mark - Getters / Setters
#pragma mark -

- (NSString *)title
{
    return [self.alertController title];
}

- (void)setTitle:(NSString *)title
{
    [self.alertController setTitle:[title copy]];
}

- (NSString *)message
{
    return [self.alertController message];
}

- (void)setMessage:(NSString *)message
{
    [self.alertController setMessage:[message copy]];
}

#pragma mark - Lifecycle
#pragma mark -

- (instancetype)initWithPresentationContext:(UIViewController *)presentationContext
{
    self = [self initWithPresentationContext:presentationContext
                              preferredStyle:UIAlertControllerStyleActionSheet];
    if (!self) {
        return nil;
    }

    return self;
}

- (instancetype)initWithPresentationContext:(UIViewController *)presentationContext
                             preferredStyle:(UIAlertControllerStyle)preferredStyle
{
    self = [super init];

    if (!self) {
        return nil;
    }

    _alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:preferredStyle];

    _presentationContext = presentationContext ?: [[[UIApplication sharedApplication] keyWindow] rootViewController];

    [self addCondition:[OPOperationConditionMutuallyExclusive alertPresentationExclusivity]];

    /**
     *  This operation modifies the view controller hierarchy.
     *  Doing this while other such operations are executing can lead to
     *  inconsistencies in UIKit. So, let's make them mutally exclusive.
     */
    [self addCondition:[OPOperationConditionMutuallyExclusive mutuallyExclusiveWith:[UIViewController class]]];

    return self;
}

@end

#endif


text:
import pytest
from mrs import hdfs
from mrs import util

@pytest.mark.hadoop
def test_home_directory():
    homedir = hdfs.hdfs_get_home_directory('0potato', 'amcnabb')
    assert homedir == '/user/amcnabb'

@pytest.mark.hadoop
def test_round_trip():
    path = '/tmp/hello-%s.txt' % util.random_string(6)
    contents = 'Hello, world!\n'

    hdfs.hdfs_create('0potato', 'amcnabb', path, contents)

    data = hdfs.hdfs_open('0potato', 'amcnabb', path).read()
    assert data == contents

    result = hdfs.hdfs_delete('0potato', 'amcnabb', path)
    assert result == True

@pytest.mark.hadoop
def test_missing_file():
    path = '/aeuaoeu/oeau/aoeu/oaeuoaeu/aoeuaoeu'
    with pytest.raises(hdfs.FileNotFoundException):
        hdfs.hdfs_open('0potato', 'amcnabb', path)

if __name__ == '__main__':
    test_hdfs()

# vim: et sw=4 sts=4


text:
import { BaseModel } from './base.model';
export class PriceType extends BaseModel {
    static fromJsonList(array): PriceType[] {
        return array.map(PriceType.fromJson);
    }
    static getColumns(): any {
        return {
            name: {
                title: 'name',
                type: 'string'
            },
        };
    }

    static fromJson({ $key, name,
        createdAt, createdBy, modifiedAt, modifiedBy, isDeleted, deletedBy, deletedAt
    }): PriceType {
        return new PriceType(
            $key, name,
            createdAt, createdBy, modifiedAt, modifiedBy, isDeleted, deletedBy, deletedAt
        );
    }
    constructor(
        id: string = null,
        public name: string = null,
        createdAt: Date = null,
        createdBy: string = null,
        modifiedAt: Date = null,
        modifiedBy: string = null,
        isDeleted: boolean = false,
        deletedBy: string = null,
        deletedAt: Date = null) {
        super(id, createdAt, createdBy, modifiedAt, modifiedBy, isDeleted, deletedBy, deletedAt);

    }

}


text:
import React from 'react';
import { Router, Route, Link } from 'react-router';
import BlogActions from '../../actions/BlogActions';

// Components
import PostForm from './PostForm.js'
import PostList from './PostList.js'

const NewArticle = React.createClass({
  render(){
    return(
      <div>
        <PostForm />
        <PostList />
      </div>
    )
  }
});

module.exports = NewArticle;


text:
package model.semisupervised.activelearning;

/**
 * Created by hanxuan on 11/2/15 for machine_learning.
 */
public interface ActiveLearning {

    default void loop(){
        while (!converge()) {
            activeTrain();
            addData();
        }
    }

    boolean converge();

    void activeTrain();

    void addData();
}