text:
<?php
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

  /**
   * The "management" collection of methods.
   * Typical usage is:
   *
   *   $analyticsService = new Google_AnalyticsService(...);
   *   $management = $analyticsService->management;
   *
   */
  class Google_ManagementServiceResource extends Google_ServiceResource {

  }

  /**
   * The "webproperties" collection of methods.
   * Typical usage is:
   *
   *   $analyticsService = new Google_AnalyticsService(...);
   *   $webproperties = $analyticsService->webproperties;
   *
   */
  class Google_ManagementWebpropertiesServiceResource extends Google_ServiceResource {

    /**
     * Lists web properties to which the user has access. (webproperties.list)
     *
     * @param string $accountId Account ID to retrieve web properties for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to.
     * @param array $optParams Optional parameters.
     *
     * @opt_param int max-results The maximum number of web properties to include in this response.
     * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
     * @return Google_Webproperties
     */
    public function listManagementWebproperties($accountId, $optParams = array()) {
      $params = array('accountId' => $accountId);
      $params = array_merge($params, $optParams);
      $data = $this->__call('list', array($params));
      if ($this->useObjects()) {
        return new Google_Webproperties($data);
      } else {
        return $data;
      }
    }
  }
  /**
   * The "segments" collection of methods.
   * Typical usage is:
   *
   *   $analyticsService = new Google_AnalyticsService(...);
   *   $segments = $analyticsService->segments;
   *
   */
  class Google_ManagementSegmentsServiceResource extends Google_ServiceResource {

    /**
     * Lists advanced segments to which the user has access. (segments.list)
     *
     * @param array $optParams Optional parameters.
     *
     * @opt_param int max-results The maximum number of advanced segments to include in this response.
     * @opt_param int start-index An index of the first advanced segment to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
     * @return Google_Segments
     */
    public function listManagementSegments($optParams = array()) {
      $params = array();
      $params = array_merge($params, $optParams);
      $data = $this->__call('list', array($params));
      if ($this->useObjects()) {
        return new Google_Segments($data);
      } else {
        return $data;
      }
    }
  }
  /**
   * The "accounts" collection of methods.
   * Typical usage is:
   *
   *   $analyticsService = new Google_AnalyticsService(...);
   *   $accounts = $analyticsService->accounts;
   *
   */
  class Google_ManagementAccountsServiceResource extends Google_ServiceResource {

    /**
     * Lists all accounts to which the user has access. (accounts.list)
     *
     * @param array $optParams Optional parameters.
     *
     * @opt_param int max-results The maximum number of accounts to include in this response.
     * @opt_param int start-index An index of the first account to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
     * @return Google_Accounts
     */
    public function listManagementAccounts($optParams = array()) {
      $params = array();
      $params = array_merge($params, $optParams);
      $data = $this->__call('list', array($params));
      if ($this->useObjects()) {
        return new Google_Accounts($data);
      } else {
        return $data;
      }
    }
  }
  /**
   * The "goals" collection of methods.
   * Typical usage is:
   *
   *   $analyticsService = new Google_AnalyticsService(...);
   *   $goals = $analyticsService->goals;
   *
   */
  class Google_ManagementGoalsServiceResource extends Google_ServiceResource {

    /**
     * Lists goals to which the user has access. (goals.list)
     *
     * @param string $accountId Account ID to retrieve goals for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to.
     * @param string $webPropertyId Web property ID to retrieve goals for. Can either be a specific web property ID or '~all', which refers to all the web properties that user has access to.
     * @param string $profileId Profile ID to retrieve goals for. Can either be a specific profile ID or '~all', which refers to all the profiles that user has access to.
     * @param array $optParams Optional parameters.
     *
     * @opt_param int max-results The maximum number of goals to include in this response.
     * @opt_param int start-index An index of the first goal to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
     * @return Google_Goals
     */
    public function listManagementGoals($accountId, $webPropertyId, $profileId, $optParams = array()) {
      $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId);
      $params = array_merge($params, $optParams);
      $data = $this->__call('list', array($params));
      if ($this->useObjects()) {
        return new Google_Goals($data);
      } else {
        return $data;
      }
    }
  }
  /**
   * The "profiles" collection of methods.
   * Typical usage is:
   *
   *   $analyticsService = new Google_AnalyticsService(...);
   *   $profiles = $analyticsService->profiles;
   *
   */
  class Google_ManagementProfilesServiceResource extends Google_ServiceResource {

    /**
     * Lists profiles to which the user has access. (profiles.list)
     *
     * @param string $accountId Account ID for the profiles to retrieve. Can either be a specific account ID or '~all', which refers to all the accounts to which the user has access.
     * @param string $webPropertyId Web property ID for the profiles to retrieve. Can either be a specific web property ID or '~all', which refers to all the web properties to which the user has access.
     * @param array $optParams Optional parameters.
     *
     * @opt_param int max-results The maximum number of profiles to include in this response.
     * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
     * @return Google_Profiles
     */
    public function listManagementProfiles($accountId, $webPropertyId, $optParams = array()) {
      $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId);
      $params = array_merge($params, $optParams);
      $data = $this->__call('list', array($params));
      if ($this->useObjects()) {
        return new Google_Profiles($data);
      } else {
        return $data;
      }
    }
  }

  /**
   * The "data" collection of methods.
   * Typical usage is:
   *
   *   $analyticsService = new Google_AnalyticsService(...);
   *   $data = $analyticsService->data;
   *
   */
  class Google_DataServiceResource extends Google_ServiceResource {

  }

  /**
   * The "mcf" collection of methods.
   * Typical usage is:
   *
   *   $analyticsService = new Google_AnalyticsService(...);
   *   $mcf = $analyticsService->mcf;
   *
   */
  class Google_DataMcfServiceResource extends Google_ServiceResource {

    /**
     * Returns Analytics Multi-Channel Funnels data for a profile. (mcf.get)
     *
     * @param string $ids Unique table ID for retrieving Analytics data. Table ID is of the form ga:XXXX, where XXXX is the Analytics profile ID.
     * @param string $start_date Start date for fetching Analytics data. All requests should specify a start date formatted as YYYY-MM-DD.
     * @param string $end_date End date for fetching Analytics data. All requests should specify an end date formatted as YYYY-MM-DD.
     * @param string $metrics A comma-separated list of Multi-Channel Funnels metrics. E.g., 'mcf:totalConversions,mcf:totalConversionValue'. At least one metric must be specified.
     * @param array $optParams Optional parameters.
     *
     * @opt_param int max-results The maximum number of entries to include in this feed.
     * @opt_param string sort A comma-separated list of dimensions or metrics that determine the sort order for the Analytics data.
     * @opt_param string dimensions A comma-separated list of Multi-Channel Funnels dimensions. E.g., 'mcf:source,mcf:medium'.
     * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
     * @opt_param string filters A comma-separated list of dimension or metric filters to be applied to the Analytics data.
     * @return Google_McfData
     */
    public function get($ids, $start_date, $end_date, $metrics, $optParams = array()) {
      $params = array('ids' => $ids, 'start-date' => $start_date, 'end-date' => $end_date, 'metrics' => $metrics);
      $params = array_merge($params, $optParams);
      $data = $this->__call('get', array($params));
      if ($this->useObjects()) {
        return new Google_McfData($data);
      } else {
        return $data;
      }
    }
  }
  /**
   * The "ga" collection of methods.
   * Typical usage is:
   *
   *   $analyticsService = new Google_AnalyticsService(...);
   *   $ga = $analyticsService->ga;
   *
   */
  class Google_DataGaServiceResource extends Google_ServiceResource {

    /**
     * Returns Analytics data for a profile. (ga.get)
     *
     * @param string $ids Unique table ID for retrieving Analytics data. Table ID is of the form ga:XXXX, where XXXX is the Analytics profile ID.
     * @param string $start_date Start date for fetching Analytics data. All requests should specify a start date formatted as YYYY-MM-DD.
     * @param string $end_date End date for fetching Analytics data. All requests should specify an end date formatted as YYYY-MM-DD.
     * @param string $metrics A comma-separated list of Analytics metrics. E.g., 'ga:visits,ga:pageviews'. At least one metric must be specified.
     * @param array $optParams Optional parameters.
     *
     * @opt_param int max-results The maximum number of entries to include in this feed.
     * @opt_param string sort A comma-separated list of dimensions or metrics that determine the sort order for Analytics data.
     * @opt_param string dimensions A comma-separated list of Analytics dimensions. E.g., 'ga:browser,ga:city'.
     * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
     * @opt_param string segment An Analytics advanced segment to be applied to data.
     * @opt_param string filters A comma-separated list of dimension or metric filters to be applied to Analytics data.
     * @return Google_GaData
     */
    public function get($ids, $start_date, $end_date, $metrics, $optParams = array()) {
      $params = array('ids' => $ids, 'start-date' => $start_date, 'end-date' => $end_date, 'metrics' => $metrics);
      $params = array_merge($params, $optParams);
      $data = $this->__call('get', array($params));
      if ($this->useObjects()) {
        return new Google_GaData($data);
      } else {
        return $data;
      }
    }
  }

/**
 * Service definition for Google_Analytics (v3).
 *
 *

 * View and manage your Google Analytics data
 *

 *
 *

 * For more information about this service, see the
 * API Documentation
 *

 *
 * @author Google, Inc.
 */
class Google_AnalyticsService extends Google_Service {
  public $management_webproperties;
  public $management_segments;
  public $management_accounts;
  public $management_goals;
  public $management_profiles;
  public $data_mcf;
  public $data_ga;
  /**
   * Constructs the internal representation of the Analytics service.
   *
   * @param Google_Client $client
   */
  public function __construct(Google_Client $client) {
    $this->servicePath = 'analytics/v3/';
    $this->version = 'v3';
    $this->serviceName = 'analytics';

    $client->addService($this->serviceName, $this->version);
    $this->management_webproperties = new Google_ManagementWebpropertiesServiceResource($this, $this->serviceName, 'webproperties', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"type": "integer", "location": "query", "format": "int32"}, "start-index": {"minimum": "1", "type": "integer", "location": "query", "format": "int32"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "analytics.management.webproperties.list", "httpMethod": "GET", "path": "management/accounts/{accountId}/webproperties", "response": {"$ref": "Webproperties"}}}}', true));
    $this->management_segments = new Google_ManagementSegmentsServiceResource($this, $this->serviceName, 'segments', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"type": "integer", "location": "query", "format": "int32"}, "start-index": {"minimum": "1", "type": "integer", "location": "query", "format": "int32"}}, "response": {"$ref": "Segments"}, "httpMethod": "GET", "path": "management/segments", "id": "analytics.management.segments.list"}}}', true));
    $this->management_accounts = new Google_ManagementAccountsServiceResource($this, $this->serviceName, 'accounts', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"type": "integer", "location": "query", "format": "int32"}, "start-index": {"minimum": "1", "type": "integer", "location": "query", "format": "int32"}}, "response": {"$ref": "Accounts"}, "httpMethod": "GET", "path": "management/accounts", "id": "analytics.management.accounts.list"}}}', true));
    $this->management_goals = new Google_ManagementGoalsServiceResource($this, $this->serviceName, 'goals', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"type": "integer", "location": "query", "format": "int32"}, "profileId": {"required": true, "type": "string", "location": "path"}, "start-index": {"minimum": "1", "type": "integer", "location": "query", "format": "int32"}, "webPropertyId": {"required": true, "type": "string", "location": "path"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "analytics.management.goals.list", "httpMethod": "GET", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals", "response": {"$ref": "Goals"}}}}', true));
    $this->management_profiles = new Google_ManagementProfilesServiceResource($this, $this->serviceName, 'profiles', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"type": "integer", "location": "query", "format": "int32"}, "start-index": {"minimum": "1", "type": "integer", "location": "query", "format": "int32"}, "webPropertyId": {"required": true, "type": "string", "location": "path"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "analytics.management.profiles.list", "httpMethod": "GET", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles", "response": {"$ref": "Profiles"}}}}', true));
    $this->data_mcf = new Google_DataMcfServiceResource($this, $this->serviceName, 'mcf', json_decode('{"methods": {"get": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"type": "integer", "location": "query", "format": "int32"}, "sort": {"type": "string", "location": "query"}, "dimensions": {"type": "string", "location": "query"}, "start-date": {"required": true, "type": "string", "location": "query"}, "start-index": {"minimum": "1", "type": "integer", "location": "query", "format": "int32"}, "ids": {"required": true, "type": "string", "location": "query"}, "metrics": {"required": true, "type": "string", "location": "query"}, "filters": {"type": "string", "location": "query"}, "end-date": {"required": true, "type": "string", "location": "query"}}, "id": "analytics.data.mcf.get", "httpMethod": "GET", "path": "data/mcf", "response": {"$ref": "McfData"}}}}', true));
    $this->data_ga = new Google_DataGaServiceResource($this, $this->serviceName, 'ga', json_decode('{"methods": {"get": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"type": "integer", "location": "query", "format": "int32"}, "sort": {"type": "string", "location": "query"}, "dimensions": {"type": "string", "location": "query"}, "start-date": {"required": true, "type": "string", "location": "query"}, "start-index": {"minimum": "1", "type": "integer", "location": "query", "format": "int32"}, "segment": {"type": "string", "location": "query"}, "ids": {"required": true, "type": "string", "location": "query"}, "metrics": {"required": true, "type": "string", "location": "query"}, "filters": {"type": "string", "location": "query"}, "end-date": {"required": true, "type": "string", "location": "query"}}, "id": "analytics.data.ga.get", "httpMethod": "GET", "path": "data/ga", "response": {"$ref": "GaData"}}}}', true));

  }
}

class Google_Account extends Google_Model {
  public $kind;
  public $name;
  public $created;
  public $updated;
  protected $__childLinkType = 'Google_AccountChildLink';
  protected $__childLinkDataType = '';
  public $childLink;
  public $id;
  public $selfLink;
  public function setKind($kind) {
    $this->kind = $kind;
  }
  public function getKind() {
    return $this->kind;
  }
  public function setName($name) {
    $this->name = $name;
  }
  public function getName() {
    return $this->name;
  }
  public function setCreated($created) {
    $this->created = $created;
  }
  public function getCreated() {
    return $this->created;
  }
  public function setUpdated($updated) {
    $this->updated = $updated;
  }
  public function getUpdated() {
    return $this->updated;
  }
  public function setChildLink(Google_AccountChildLink $childLink) {
    $this->childLink = $childLink;
  }
  public function getChildLink() {
    return $this->childLink;
  }
  public function setId($id) {
    $this->id = $id;
  }
  public function getId() {
    return $this->id;
  }
  public function setSelfLink($selfLink) {
    $this->selfLink = $selfLink;
  }
  public function getSelfLink() {
    return $this->selfLink;
  }
}

class Google_AccountChildLink extends Google_Model {
  public $href;
  public $type;
  public function setHref($href) {
    $this->href = $href;
  }
  public function getHref() {
    return $this->href;
  }
  public function setType($type) {
    $this->type = $type;
  }
  public function getType() {
    return $this->type;
  }
}

class Google_Accounts extends Google_Model {
  public $username;
  public $kind;
  protected $__itemsType = 'Google_Account';
  protected $__itemsDataType = 'array';
  public $items;
  public $itemsPerPage;
  public $previousLink;
  public $startIndex;
  public $nextLink;
  public $totalResults;
  public function setUsername($username) {
    $this->username = $username;
  }
  public function getUsername() {
    return $this->username;
  }
  public function setKind($kind) {
    $this->kind = $kind;
  }
  public function getKind() {
    return $this->kind;
  }
  public function setItems(/* array(Google_Account) */ $items) {
    $this->assertIsArray($items, 'Google_Account', __METHOD__);
    $this->items = $items;
  }
  public function getItems() {
    return $this->items;
  }
  public function setItemsPerPage($itemsPerPage) {
    $this->itemsPerPage = $itemsPerPage;
  }
  public function getItemsPerPage() {
    return $this->itemsPerPage;
  }
  public function setPreviousLink($previousLink) {
    $this->previousLink = $previousLink;
  }
  public function getPreviousLink() {
    return $this->previousLink;
  }
  public function setStartIndex($startIndex) {
    $this->startIndex = $startIndex;
  }
  public function getStartIndex() {
    return $this->startIndex;
  }
  public function setNextLink($nextLink) {
    $this->nextLink = $nextLink;
  }
  public function getNextLink() {
    return $this->nextLink;
  }
  public function setTotalResults($totalResults) {
    $this->totalResults = $totalResults;
  }
  public function getTotalResults() {
    return $this->totalResults;
  }
}

class Google_GaData extends Google_Model {
  public $kind;
  public $rows;
  public $containsSampledData;
  public $totalResults;
  public $itemsPerPage;
  public $totalsForAllResults;
  public $nextLink;
  public $id;
  protected $__queryType = 'Google_GaDataQuery';
  protected $__queryDataType = '';
  public $query;
  public $previousLink;
  protected $__profileInfoType = 'Google_GaDataProfileInfo';
  protected $__profileInfoDataType = '';
  public $profileInfo;
  protected $__columnHeadersType = 'Google_GaDataColumnHeaders';
  protected $__columnHeadersDataType = 'array';
  public $columnHeaders;
  public $selfLink;
  public function setKind($kind) {
    $this->kind = $kind;
  }
  public function getKind() {
    return $this->kind;
  }
  public function setRows(/* array(Google_string) */ $rows) {
    $this->assertIsArray($rows, 'Google_string', __METHOD__);
    $this->rows = $rows;
  }
  public function getRows() {
    return $this->rows;
  }
  public function setContainsSampledData($containsSampledData) {
    $this->containsSampledData = $containsSampledData;
  }
  public function getContainsSampledData() {
    return $this->containsSampledData;
  }
  public function setTotalResults($totalResults) {
    $this->totalResults = $totalResults;
  }
  public function getTotalResults() {
    return $this->totalResults;
  }
  public function setItemsPerPage($itemsPerPage) {
    $this->itemsPerPage = $itemsPerPage;
  }
  public function getItemsPerPage() {
    return $this->itemsPerPage;
  }
  public function setTotalsForAllResults($totalsForAllResults) {
    $this->totalsForAllResults = $totalsForAllResults;
  }
  public function getTotalsForAllResults() {
    return $this->totalsForAllResults;
  }
  public function setNextLink($nextLink) {
    $this->nextLink = $nextLink;
  }
  public function getNextLink() {
    return $this->nextLink;
  }
  public function setId($id) {
    $this->id = $id;
  }
  public function getId() {
    return $this->id;
  }
  public function setQuery(Google_GaDataQuery $query) {
    $this->query = $query;
  }
  public function getQuery() {
    return $this->query;
  }
  public function setPreviousLink($previousLink) {
    $this->previousLink = $previousLink;
  }
  public function getPreviousLink() {
    return $this->previousLink;
  }
  public function setProfileInfo(Google_GaDataProfileInfo $profileInfo) {
    $this->profileInfo = $profileInfo;
  }
  public function getProfileInfo() {
    return $this->profileInfo;
  }
  public function setColumnHeaders(/* array(Google_GaDataColumnHeaders) */ $columnHeaders) {
    $this->assertIsArray($columnHeaders, 'Google_GaDataColumnHeaders', __METHOD__);
    $this->columnHeaders = $columnHeaders;
  }
  public function getColumnHeaders() {
    return $this->columnHeaders;
  }
  public function setSelfLink($selfLink) {
    $this->selfLink = $selfLink;
  }
  public function getSelfLink() {
    return $this->selfLink;
  }
}

class Google_GaDataColumnHeaders extends Google_Model {
  public $dataType;
  public $columnType;
  public $name;
  public function setDataType($dataType) {
    $this->dataType = $dataType;
  }
  public function getDataType() {
    return $this->dataType;
  }
  public function setColumnType($columnType) {
    $this->columnType = $columnType;
  }
  public function getColumnType() {
    return $this->columnType;
  }
  public function setName($name) {
    $this->name = $name;
  }
  public function getName() {
    return $this->name;
  }
}

class Google_GaDataProfileInfo extends Google_Model {
  public $webPropertyId;
  public $internalWebPropertyId;
  public $tableId;
  public $profileId;
  public $profileName;
  public $accountId;
  public function setWebPropertyId($webPropertyId) {
    $this->webPropertyId = $webPropertyId;
  }
  public function getWebPropertyId() {
    return $this->webPropertyId;
  }
  public function setInternalWebPropertyId($internalWebPropertyId) {
    $this->internalWebPropertyId = $internalWebPropertyId;
  }
  public function getInternalWebPropertyId() {
    return $this->internalWebPropertyId;
  }
  public function setTableId($tableId) {
    $this->tableId = $tableId;
  }
  public function getTableId() {
    return $this->tableId;
  }
  public function setProfileId($profileId) {
    $this->profileId = $profileId;
  }
  public function getProfileId() {
    return $this->profileId;
  }
  public function setProfileName($profileName) {
    $this->profileName = $profileName;
  }
  public function getProfileName() {
    return $this->profileName;
  }
  public function setAccountId($accountId) {
    $this->accountId = $accountId;
  }
  public function getAccountId() {
    return $this->accountId;
  }
}

class Google_GaDataQuery extends Google_Model {
  public $max_results;
  public $sort;
  public $dimensions;
  public $start_date;
  public $start_index;
  public $segment;
  public $ids;
  public $metrics;
  public $filters;
  public $end_date;
  public function setMax_results($max_results) {
    $this->max_results = $max_results;
  }
  public function getMax_results() {
    return $this->max_results;
  }
  public function setSort(/* array(Google_string) */ $sort) {
    $this->assertIsArray($sort, 'Google_string', __METHOD__);
    $this->sort = $sort;
  }
  public function getSort() {
    return $this->sort;
  }
  public function setDimensions($dimensions) {
    $this->dimensions = $dimensions;
  }
  public function getDimensions() {
    return $this->dimensions;
  }
  public function setStart_date($start_date) {
    $this->start_date = $start_date;
  }
  public function getStart_date() {
    return $this->start_date;
  }
  public function setStart_index($start_index) {
    $this->start_index = $start_index;
  }
  public function getStart_index() {
    return $this->start_index;
  }
  public function setSegment($segment) {
    $this->segment = $segment;
  }
  public function getSegment() {
    return $this->segment;
  }
  public function setIds($ids) {
    $this->ids = $ids;
  }
  public function getIds() {
    return $this->ids;
  }
  public function setMetrics(/* array(Google_string) */ $metrics) {
    $this->assertIsArray($metrics, 'Google_string', __METHOD__);
    $this->metrics = $metrics;
  }
  public function getMetrics() {
    return $this->metrics;
  }
  public function setFilters($filters) {
    $this->filters = $filters;
  }
  public function getFilters() {
    return $this->filters;
  }
  public function setEnd_date($end_date) {
    $this->end_date = $end_date;
  }
  public function getEnd_date() {
    return $this->end_date;
  }
}

class Google_Goal extends Google_Model {
  public $kind;
  protected $__visitTimeOnSiteDetailsType = 'Google_GoalVisitTimeOnSiteDetails';
  protected $__visitTimeOnSiteDetailsDataType = '';
  public $visitTimeOnSiteDetails;
  public $name;
  public $created;
  protected $__urlDestinationDetailsType = 'Google_GoalUrlDestinationDetails';
  protected $__urlDestinationDetailsDataType = '';
  public $urlDestinationDetails;
  public $updated;
  public $value;
  protected $__visitNumPagesDetailsType = 'Google_GoalVisitNumPagesDetails';
  protected $__visitNumPagesDetailsDataType = '';
  public $visitNumPagesDetails;
  public $internalWebPropertyId;
  protected $__eventDetailsType = 'Google_GoalEventDetails';
  protected $__eventDetailsDataType = '';
  public $eventDetails;
  public $webPropertyId;
  public $active;
  public $profileId;
  protected $__parentLinkType = 'Google_GoalParentLink';
  protected $__parentLinkDataType = '';
  public $parentLink;
  public $type;
  public $id;
  public $selfLink;
  public $accountId;
  public function setKind($kind) {
    $this->kind = $kind;
  }
  public function getKind() {
    return $this->kind;
  }
  public function setVisitTimeOnSiteDetails(Google_GoalVisitTimeOnSiteDetails $visitTimeOnSiteDetails) {
    $this->visitTimeOnSiteDetails = $visitTimeOnSiteDetails;
  }
  public function getVisitTimeOnSiteDetails() {
    return $this->visitTimeOnSiteDetails;
  }
  public function setName($name) {
    $this->name = $name;
  }
  public function getName() {
    return $this->name;
  }
  public function setCreated($created) {
    $this->created = $created;
  }
  public function getCreated() {
    return $this->created;
  }
  public function setUrlDestinationDetails(Google_GoalUrlDestinationDetails $urlDestinationDetails) {
    $this->urlDestinationDetails = $urlDestinationDetails;
  }
  public function getUrlDestinationDetails() {
    return $this->urlDestinationDetails;
  }
  public function setUpdated($updated) {
    $this->updated = $updated;
  }
  public function getUpdated() {
    return $this->updated;
  }
  public function setValue($value) {
    $this->value = $value;
  }
  public function getValue() {
    return $this->value;
  }
  public function setVisitNumPagesDetails(Google_GoalVisitNumPagesDetails $visitNumPagesDetails) {
    $this->visitNumPagesDetails = $visitNumPagesDetails;
  }
  public function getVisitNumPagesDetails() {
    return $this->visitNumPagesDetails;
  }
  public function setInternalWebPropertyId($internalWebPropertyId) {
    $this->internalWebPropertyId = $internalWebPropertyId;
  }
  public function getInternalWebPropertyId() {
    return $this->internalWebPropertyId;
  }
  public function setEventDetails(Google_GoalEventDetails $eventDetails) {
    $this->eventDetails = $eventDetails;
  }
  public function getEventDetails() {
    return $this->eventDetails;
  }
  public function setWebPropertyId($webPropertyId) {
    $this->webPropertyId = $webPropertyId;
  }
  public function getWebPropertyId() {
    return $this->webPropertyId;
  }
  public function setActive($active) {
    $this->active = $active;
  }
  public function getActive() {
    return $this->active;
  }
  public function setProfileId($profileId) {
    $this->profileId = $profileId;
  }
  public function getProfileId() {
    return $this->profileId;
  }
  public function setParentLink(Google_GoalParentLink $parentLink) {
    $this->parentLink = $parentLink;
  }
  public function getParentLink() {
    return $this->parentLink;
  }
  public function setType($type) {
    $this->type = $type;
  }
  public function getType() {
    return $this->type;
  }
  public function setId($id) {
    $this->id = $id;
  }
  public function getId() {
    return $this->id;
  }
  public function setSelfLink($selfLink) {
    $this->selfLink = $selfLink;
  }
  public function getSelfLink() {
    return $this->selfLink;
  }
  public function setAccountId($accountId) {
    $this->accountId = $accountId;
  }
  public function getAccountId() {
    return $this->accountId;
  }
}

class Google_GoalEventDetails extends Google_Model {
  protected $__eventConditionsType = 'Google_GoalEventDetailsEventConditions';
  protected $__eventConditionsDataType = 'array';
  public $eventConditions;
  public $useEventValue;
  public function setEventConditions(/* array(Google_GoalEventDetailsEventConditions) */ $eventConditions) {
    $this->assertIsArray($eventConditions, 'Google_GoalEventDetailsEventConditions', __METHOD__);
    $this->eventConditions = $eventConditions;
  }
  public function getEventConditions() {
    return $this->eventConditions;
  }
  public function setUseEventValue($useEventValue) {
    $this->useEventValue = $useEventValue;
  }
  public function getUseEventValue() {
    return $this->useEventValue;
  }
}

class Google_GoalEventDetailsEventConditions extends Google_Model {
  public $type;
  public $matchType;
  public $expression;
  public $comparisonType;
  public $comparisonValue;
  public function setType($type) {
    $this->type = $type;
  }
  public function getType() {
    return $this->type;
  }
  public function setMatchType($matchType) {
    $this->matchType = $matchType;
  }
  public function getMatchType() {
    return $this->matchType;
  }
  public function setExpression($expression) {
    $this->expression = $expression;
  }
  public function getExpression() {
    return $this->expression;
  }
  public function setComparisonType($comparisonType) {
    $this->comparisonType = $comparisonType;
  }
  public function getComparisonType() {
    return $this->comparisonType;
  }
  public function setComparisonValue($comparisonValue) {
    $this->comparisonValue = $comparisonValue;
  }
  public function getComparisonValue() {
    return $this->comparisonValue;
  }
}

class Google_GoalParentLink extends Google_Model {
  public $href;
  public $type;
  public function setHref($href) {
    $this->href = $href;
  }
  public function getHref() {
    return $this->href;
  }
  public function setType($type) {
    $this->type = $type;
  }
  public function getType() {
    return $this->type;
  }
}

class Google_GoalUrlDestinationDetails extends Google_Model {
  public $url;
  public $caseSensitive;
  public $matchType;
  protected $__stepsType = 'Google_GoalUrlDestinationDetailsSteps';
  protected $__stepsDataType = 'array';
  public $steps;
  public $firstStepRequired;
  public function setUrl($url) {
    $this->url = $url;
  }
  public function getUrl() {
    return $this->url;
  }
  public function setCaseSensitive($caseSensitive) {
    $this->caseSensitive = $caseSensitive;
  }
  public function getCaseSensitive() {
    return $this->caseSensitive;
  }
  public function setMatchType($matchType) {
    $this->matchType = $matchType;
  }
  public function getMatchType() {
    return $this->matchType;
  }
  public function setSteps(/* array(Google_GoalUrlDestinationDetailsSteps) */ $steps) {
    $this->assertIsArray($steps, 'Google_GoalUrlDestinationDetailsSteps', __METHOD__);
    $this->steps = $steps;
  }
  public function getSteps() {
    return $this->steps;
  }
  public function setFirstStepRequired($firstStepRequired) {
    $this->firstStepRequired = $firstStepRequired;
  }
  public function getFirstStepRequired() {
    return $this->firstStepRequired;
  }
}

class Google_GoalUrlDestinationDetailsSteps extends Google_Model {
  public $url;
  public $name;
  public $number;
  public function setUrl($url) {
    $this->url = $url;
  }
  public function getUrl() {
    return $this->url;
  }
  public function setName($name) {
    $this->name = $name;
  }
  public function getName() {
    return $this->name;
  }
  public function setNumber($number) {
    $this->number = $number;
  }
  public function getNumber() {
    return $this->number;
  }
}

class Google_GoalVisitNumPagesDetails extends Google_Model {
  public $comparisonType;
  public $comparisonValue;
  public function setComparisonType($comparisonType) {
    $this->comparisonType = $comparisonType;
  }
  public function getComparisonType() {
    return $this->comparisonType;
  }
  public function setComparisonValue($comparisonValue) {
    $this->comparisonValue = $comparisonValue;
  }
  public function getComparisonValue() {
    return $this->comparisonValue;
  }
}

class Google_GoalVisitTimeOnSiteDetails extends Google_Model {
  public $comparisonType;
  public $comparisonValue;
  public function setComparisonType($comparisonType) {
    $this->comparisonType = $comparisonType;
  }
  public function getComparisonType() {
    return $this->comparisonType;
  }
  public function setComparisonValue($comparisonValue) {
    $this->comparisonValue = $comparisonValue;
  }
  public function getComparisonValue() {
    return $this->comparisonValue;
  }
}

class Google_Goals extends Google_Model {
  public $username;
  public $kind;
  protected $__itemsType = 'Google_Goal';
  protected $__itemsDataType = 'array';
  public $items;
  public $itemsPerPage;
  public $previousLink;
  public $startIndex;
  public $nextLink;
  public $totalResults;
  public function setUsername($username) {
    $this->username = $username;
  }
  public function getUsername() {
    return $this->username;
  }
  public function setKind($kind) {
    $this->kind = $kind;
  }
  public function getKind() {
    return $this->kind;
  }
  public function setItems(/* array(Google_Goal) */ $items) {
    $this->assertIsArray($items, 'Google_Goal', __METHOD__);
    $this->items = $items;
  }
  public function getItems() {
    return $this->items;
  }
  public function setItemsPerPage($itemsPerPage) {
    $this->itemsPerPage = $itemsPerPage;
  }
  public function getItemsPerPage() {
    return $this->itemsPerPage;
  }
  public function setPreviousLink($previousLink) {
    $this->previousLink = $previousLink;
  }
  public function getPreviousLink() {
    return $this->previousLink;
  }
  public function setStartIndex($startIndex) {
    $this->startIndex = $startIndex;
  }
  public function getStartIndex() {
    return $this->startIndex;
  }
  public function setNextLink($nextLink) {
    $this->nextLink = $nextLink;
  }
  public function getNextLink() {
    return $this->nextLink;
  }
  public function setTotalResults($totalResults) {
    $this->totalResults = $totalResults;
  }
  public function getTotalResults() {
    return $this->totalResults;
  }
}

class Google_McfData extends Google_Model {
  public $kind;
  protected $__rowsType = 'Google_McfDataRows';
  protected $__rowsDataType = 'array';
  public $rows;
  public $containsSampledData;
  public $totalResults;
  public $itemsPerPage;
  public $totalsForAllResults;
  public $nextLink;
  public $id;
  protected $__queryType = 'Google_McfDataQuery';
  protected $__queryDataType = '';
  public $query;
  public $previousLink;
  protected $__profileInfoType = 'Google_McfDataProfileInfo';
  protected $__profileInfoDataType = '';
  public $profileInfo;
  protected $__columnHeadersType = 'Google_McfDataColumnHeaders';
  protected $__columnHeadersDataType = 'array';
  public $columnHeaders;
  public $selfLink;
  public function setKind($kind) {
    $this->kind = $kind;
  }
  public function getKind() {
    return $this->kind;
  }
  public function setRows(/* array(Google_McfDataRows) */ $rows) {
    $this->assertIsArray($rows, 'Google_McfDataRows', __METHOD__);
    $this->rows = $rows;
  }
  public function getRows() {
    return $this->rows;
  }
  public function setContainsSampledData($containsSampledData) {
    $this->containsSampledData = $containsSampledData;
  }
  public function getContainsSampledData() {
    return $this->containsSampledData;
  }
  public function setTotalResults($totalResults) {
    $this->totalResults = $totalResults;
  }
  public function getTotalResults() {
    return $this->totalResults;
  }
  public function setItemsPerPage($itemsPerPage) {
    $this->itemsPerPage = $itemsPerPage;
  }
  public function getItemsPerPage() {
    return $this->itemsPerPage;
  }
  public function setTotalsForAllResults($totalsForAllResults) {
    $this->totalsForAllResults = $totalsForAllResults;
  }
  public function getTotalsForAllResults() {
    return $this->totalsForAllResults;
  }
  public function setNextLink($nextLink) {
    $this->nextLink = $nextLink;
  }
  public function getNextLink() {
    return $this->nextLink;
  }
  public function setId($id) {
    $this->id = $id;
  }
  public function getId() {
    return $this->id;
  }
  public function setQuery(Google_McfDataQuery $query) {
    $this->query = $query;
  }
  public function getQuery() {
    return $this->query;
  }
  public function setPreviousLink($previousLink) {
    $this->previousLink = $previousLink;
  }
  public function getPreviousLink() {
    return $this->previousLink;
  }
  public function setProfileInfo(Google_McfDataProfileInfo $profileInfo) {
    $this->profileInfo = $profileInfo;
  }
  public function getProfileInfo() {
    return $this->profileInfo;
  }
  public function setColumnHeaders(/* array(Google_McfDataColumnHeaders) */ $columnHeaders) {
    $this->assertIsArray($columnHeaders, 'Google_McfDataColumnHeaders', __METHOD__);
    $this->columnHeaders = $columnHeaders;
  }
  public function getColumnHeaders() {
    return $this->columnHeaders;
  }
  public function setSelfLink($selfLink) {
    $this->selfLink = $selfLink;
  }
  public function getSelfLink() {
    return $this->selfLink;
  }
}

class Google_McfDataColumnHeaders extends Google_Model {
  public $dataType;
  public $columnType;
  public $name;
  public function setDataType($dataType) {
    $this->dataType = $dataType;
  }
  public function getDataType() {
    return $this->dataType;
  }
  public function setColumnType($columnType) {
    $this->columnType = $columnType;
  }
  public function getColumnType() {
    return $this->columnType;
  }
  public function setName($name) {
    $this->name = $name;
  }
  public function getName() {
    return $this->name;
  }
}

class Google_McfDataProfileInfo extends Google_Model {
  public $webPropertyId;
  public $internalWebPropertyId;
  public $tableId;
  public $profileId;
  public $profileName;
  public $accountId;
  public function setWebPropertyId($webPropertyId) {
    $this->webPropertyId = $webPropertyId;
  }
  public function getWebPropertyId() {
    return $this->webPropertyId;
  }
  public function setInternalWebPropertyId($internalWebPropertyId) {
    $this->internalWebPropertyId = $internalWebPropertyId;
  }
  public function getInternalWebPropertyId() {
    return $this->internalWebPropertyId;
  }
  public function setTableId($tableId) {
    $this->tableId = $tableId;
  }
  public function getTableId() {
    return $this->tableId;
  }
  public function setProfileId($profileId) {
    $this->profileId = $profileId;
  }
  public function getProfileId() {
    return $this->profileId;
  }
  public function setProfileName($profileName) {
    $this->profileName = $profileName;
  }
  public function getProfileName() {
    return $this->profileName;
  }
  public function setAccountId($accountId) {
    $this->accountId = $accountId;
  }
  public function getAccountId() {
    return $this->accountId;
  }
}

class Google_McfDataQuery extends Google_Model {
  public $max_results;
  public $sort;
  public $dimensions;
  public $start_date;
  public $start_index;
  public $segment;
  public $ids;
  public $metrics;
  public $filters;
  public $end_date;
  public function setMax_results($max_results) {
    $this->max_results = $max_results;
  }
  public function getMax_results() {
    return $this->max_results;
  }
  public function setSort(/* array(Google_string) */ $sort) {
    $this->assertIsArray($sort, 'Google_string', __METHOD__);
    $this->sort = $sort;
  }
  public function getSort() {
    return $this->sort;
  }
  public function setDimensions($dimensions) {
    $this->dimensions = $dimensions;
  }
  public function getDimensions() {
    return $this->dimensions;
  }
  public function setStart_date($start_date) {
    $this->start_date = $start_date;
  }
  public function getStart_date() {
    return $this->start_date;
  }
  public function setStart_index($start_index) {
    $this->start_index = $start_index;
  }
  public function getStart_index() {
    return $this->start_index;
  }
  public function setSegment($segment) {
    $this->segment = $segment;
  }
  public function getSegment() {
    return $this->segment;
  }
  public function setIds($ids) {
    $this->ids = $ids;
  }
  public function getIds() {
    return $this->ids;
  }
  public function setMetrics(/* array(Google_string) */ $metrics) {
    $this->assertIsArray($metrics, 'Google_string', __METHOD__);
    $this->metrics = $metrics;
  }
  public function getMetrics() {
    return $this->metrics;
  }
  public function setFilters($filters) {
    $this->filters = $filters;
  }
  public function getFilters() {
    return $this->filters;
  }
  public function setEnd_date($end_date) {
    $this->end_date = $end_date;
  }
  public function getEnd_date() {
    return $this->end_date;
  }
}

class Google_McfDataRows extends Google_Model {
  public $primitiveValue;
  protected $__conversionPathValueType = 'Google_McfDataRowsConversionPathValue';
  protected $__conversionPathValueDataType = 'array';
  public $conversionPathValue;
  public function setPrimitiveValue($primitiveValue) {
    $this->primitiveValue = $primitiveValue;
  }
  public function getPrimitiveValue() {
    return $this->primitiveValue;
  }
  public function setConversionPathValue(/* array(Google_McfDataRowsConversionPathValue) */ $conversionPathValue) {
    $this->assertIsArray($conversionPathValue, 'Google_McfDataRowsConversionPathValue', __METHOD__);
    $this->conversionPathValue = $conversionPathValue;
  }
  public function getConversionPathValue() {
    return $this->conversionPathValue;
  }
}

class Google_McfDataRowsConversionPathValue extends Google_Model {
  public $nodeValue;
  public $interactionType;
  public function setNodeValue($nodeValue) {
    $this->nodeValue = $nodeValue;
  }
  public function getNodeValue() {
    return $this->nodeValue;
  }
  public function setInteractionType($interactionType) {
    $this->interactionType = $interactionType;
  }
  public function getInteractionType() {
    return $this->interactionType;
  }
}

class Google_Profile extends Google_Model {
  public $defaultPage;
  public $kind;
  public $excludeQueryParameters;
  public $name;
  public $created;
  public $webPropertyId;
  public $updated;
  public $siteSearchQueryParameters;
  public $currency;
  public $internalWebPropertyId;
  protected $__childLinkType = 'Google_ProfileChildLink';
  protected $__childLinkDataType = '';
  public $childLink;
  public $timezone;
  public $siteSearchCategoryParameters;
  protected $__parentLinkType = 'Google_ProfileParentLink';
  protected $__parentLinkDataType = '';
  public $parentLink;
  public $id;
  public $selfLink;
  public $accountId;
  public function setDefaultPage($defaultPage) {
    $this->defaultPage = $defaultPage;
  }
  public function getDefaultPage() {
    return $this->defaultPage;
  }
  public function setKind($kind) {
    $this->kind = $kind;
  }
  public function getKind() {
    return $this->kind;
  }
  public function setExcludeQueryParameters($excludeQueryParameters) {
    $this->excludeQueryParameters = $excludeQueryParameters;
  }
  public function getExcludeQueryParameters() {
    return $this->excludeQueryParameters;
  }
  public function setName($name) {
    $this->name = $name;
  }
  public function getName() {
    return $this->name;
  }
  public function setCreated($created) {
    $this->created = $created;
  }
  public function getCreated() {
    return $this->created;
  }
  public function setWebPropertyId($webPropertyId) {
    $this->webPropertyId = $webPropertyId;
  }
  public function getWebPropertyId() {
    return $this->webPropertyId;
  }
  public function setUpdated($updated) {
    $this->updated = $updated;
  }
  public function getUpdated() {
    return $this->updated;
  }
  public function setSiteSearchQueryParameters($siteSearchQueryParameters) {
    $this->siteSearchQueryParameters = $siteSearchQueryParameters;
  }
  public function getSiteSearchQueryParameters() {
    return $this->siteSearchQueryParameters;
  }
  public function setCurrency($currency) {
    $this->currency = $currency;
  }
  public function getCurrency() {
    return $this->currency;
  }
  public function setInternalWebPropertyId($internalWebPropertyId) {
    $this->internalWebPropertyId = $internalWebPropertyId;
  }
  public function getInternalWebPropertyId() {
    return $this->internalWebPropertyId;
  }
  public function setChildLink(Google_ProfileChildLink $childLink) {
    $this->childLink = $childLink;
  }
  public function getChildLink() {
    return $this->childLink;
  }
  public function setTimezone($timezone) {
    $this->timezone = $timezone;
  }
  public function getTimezone() {
    return $this->timezone;
  }
  public function setSiteSearchCategoryParameters($siteSearchCategoryParameters) {
    $this->siteSearchCategoryParameters = $siteSearchCategoryParameters;
  }
  public function getSiteSearchCategoryParameters() {
    return $this->siteSearchCategoryParameters;
  }
  public function setParentLink(Google_ProfileParentLink $parentLink) {
    $this->parentLink = $parentLink;
  }
  public function getParentLink() {
    return $this->parentLink;
  }
  public function setId($id) {
    $this->id = $id;
  }
  public function getId() {
    return $this->id;
  }
  public function setSelfLink($selfLink) {
    $this->selfLink = $selfLink;
  }
  public function getSelfLink() {
    return $this->selfLink;
  }
  public function setAccountId($accountId) {
    $this->accountId = $accountId;
  }
  public function getAccountId() {
    return $this->accountId;
  }
}

class Google_ProfileChildLink extends Google_Model {
  public $href;
  public $type;
  public function setHref($href) {
    $this->href = $href;
  }
  public function getHref() {
    return $this->href;
  }
  public function setType($type) {
    $this->type = $type;
  }
  public function getType() {
    return $this->type;
  }
}

class Google_ProfileParentLink extends Google_Model {
  public $href;
  public $type;
  public function setHref($href) {
    $this->href = $href;
  }
  public function getHref() {
    return $this->href;
  }
  public function setType($type) {
    $this->type = $type;
  }
  public function getType() {
    return $this->type;
  }
}

class Google_Profiles extends Google_Model {
  public $username;
  public $kind;
  protected $__itemsType = 'Google_Profile';
  protected $__itemsDataType = 'array';
  public $items;
  public $itemsPerPage;
  public $previousLink;
  public $startIndex;
  public $nextLink;
  public $totalResults;
  public function setUsername($username) {
    $this->username = $username;
  }
  public function getUsername() {
    return $this->username;
  }
  public function setKind($kind) {
    $this->kind = $kind;
  }
  public function getKind() {
    return $this->kind;
  }
  public function setItems(/* array(Google_Profile) */ $items) {
    $this->assertIsArray($items, 'Google_Profile', __METHOD__);
    $this->items = $items;
  }
  public function getItems() {
    return $this->items;
  }
  public function setItemsPerPage($itemsPerPage) {
    $this->itemsPerPage = $itemsPerPage;
  }
  public function getItemsPerPage() {
    return $this->itemsPerPage;
  }
  public function setPreviousLink($previousLink) {
    $this->previousLink = $previousLink;
  }
  public function getPreviousLink() {
    return $this->previousLink;
  }
  public function setStartIndex($startIndex) {
    $this->startIndex = $startIndex;
  }
  public function getStartIndex() {
    return $this->startIndex;
  }
  public function setNextLink($nextLink) {
    $this->nextLink = $nextLink;
  }
  public function getNextLink() {
    return $this->nextLink;
  }
  public function setTotalResults($totalResults) {
    $this->totalResults = $totalResults;
  }
  public function getTotalResults() {
    return $this->totalResults;
  }
}

class Google_Segment extends Google_Model {
  public $definition;
  public $kind;
  public $segmentId;
  public $created;
  public $updated;
  public $id;
  public $selfLink;
  public $name;
  public function setDefinition($definition) {
    $this->definition = $definition;
  }
  public function getDefinition() {
    return $this->definition;
  }
  public function setKind($kind) {
    $this->kind = $kind;
  }
  public function getKind() {
    return $this->kind;
  }
  public function setSegmentId($segmentId) {
    $this->segmentId = $segmentId;
  }
  public function getSegmentId() {
    return $this->segmentId;
  }
  public function setCreated($created) {
    $this->created = $created;
  }
  public function getCreated() {
    return $this->created;
  }
  public function setUpdated($updated) {
    $this->updated = $updated;
  }
  public function getUpdated() {
    return $this->updated;
  }
  public function setId($id) {
    $this->id = $id;
  }
  public function getId() {
    return $this->id;
  }
  public function setSelfLink($selfLink) {
    $this->selfLink = $selfLink;
  }
  public function getSelfLink() {
    return $this->selfLink;
  }
  public function setName($name) {
    $this->name = $name;
  }
  public function getName() {
    return $this->name;
  }
}

class Google_Segments extends Google_Model {
  public $username;
  public $kind;
  protected $__itemsType = 'Google_Segment';
  protected $__itemsDataType = 'array';
  public $items;
  public $itemsPerPage;
  public $previousLink;
  public $startIndex;
  public $nextLink;
  public $totalResults;
  public function setUsername($username) {
    $this->username = $username;
  }
  public function getUsername() {
    return $this->username;
  }
  public function setKind($kind) {
    $this->kind = $kind;
  }
  public function getKind() {
    return $this->kind;
  }
  public function setItems(/* array(Google_Segment) */ $items) {
    $this->assertIsArray($items, 'Google_Segment', __METHOD__);
    $this->items = $items;
  }
  public function getItems() {
    return $this->items;
  }
  public function setItemsPerPage($itemsPerPage) {
    $this->itemsPerPage = $itemsPerPage;
  }
  public function getItemsPerPage() {
    return $this->itemsPerPage;
  }
  public function setPreviousLink($previousLink) {
    $this->previousLink = $previousLink;
  }
  public function getPreviousLink() {
    return $this->previousLink;
  }
  public function setStartIndex($startIndex) {
    $this->startIndex = $startIndex;
  }
  public function getStartIndex() {
    return $this->startIndex;
  }
  public function setNextLink($nextLink) {
    $this->nextLink = $nextLink;
  }
  public function getNextLink() {
    return $this->nextLink;
  }
  public function setTotalResults($totalResults) {
    $this->totalResults = $totalResults;
  }
  public function getTotalResults() {
    return $this->totalResults;
  }
}

class Google_Webproperties extends Google_Model {
  public $username;
  public $kind;
  protected $__itemsType = 'Google_Webproperty';
  protected $__itemsDataType = 'array';
  public $items;
  public $itemsPerPage;
  public $previousLink;
  public $startIndex;
  public $nextLink;
  public $totalResults;
  public function setUsername($username) {
    $this->username = $username;
  }
  public function getUsername() {
    return $this->username;
  }
  public function setKind($kind) {
    $this->kind = $kind;
  }
  public function getKind() {
    return $this->kind;
  }
  public function setItems(/* array(Google_Webproperty) */ $items) {
    $this->assertIsArray($items, 'Google_Webproperty', __METHOD__);
    $this->items = $items;
  }
  public function getItems() {
    return $this->items;
  }
  public function setItemsPerPage($itemsPerPage) {
    $this->itemsPerPage = $itemsPerPage;
  }
  public function getItemsPerPage() {
    return $this->itemsPerPage;
  }
  public function setPreviousLink($previousLink) {
    $this->previousLink = $previousLink;
  }
  public function getPreviousLink() {
    return $this->previousLink;
  }
  public function setStartIndex($startIndex) {
    $this->startIndex = $startIndex;
  }
  public function getStartIndex() {
    return $this->startIndex;
  }
  public function setNextLink($nextLink) {
    $this->nextLink = $nextLink;
  }
  public function getNextLink() {
    return $this->nextLink;
  }
  public function setTotalResults($totalResults) {
    $this->totalResults = $totalResults;
  }
  public function getTotalResults() {
    return $this->totalResults;
  }
}

class Google_Webproperty extends Google_Model {
  public $kind;
  public $name;
  public $created;
  public $updated;
  public $websiteUrl;
  public $internalWebPropertyId;
  protected $__childLinkType = 'Google_WebpropertyChildLink';
  protected $__childLinkDataType = '';
  public $childLink;
  protected $__parentLinkType = 'Google_WebpropertyParentLink';
  protected $__parentLinkDataType = '';
  public $parentLink;
  public $id;
  public $selfLink;
  public $accountId;
  public function setKind($kind) {
    $this->kind = $kind;
  }
  public function getKind() {
    return $this->kind;
  }
  public function setName($name) {
    $this->name = $name;
  }
  public function getName() {
    return $this->name;
  }
  public function setCreated($created) {
    $this->created = $created;
  }
  public function getCreated() {
    return $this->created;
  }
  public function setUpdated($updated) {
    $this->updated = $updated;
  }
  public function getUpdated() {
    return $this->updated;
  }
  public function setWebsiteUrl($websiteUrl) {
    $this->websiteUrl = $websiteUrl;
  }
  public function getWebsiteUrl() {
    return $this->websiteUrl;
  }
  public function setInternalWebPropertyId($internalWebPropertyId) {
    $this->internalWebPropertyId = $internalWebPropertyId;
  }
  public function getInternalWebPropertyId() {
    return $this->internalWebPropertyId;
  }
  public function setChildLink(Google_WebpropertyChildLink $childLink) {
    $this->childLink = $childLink;
  }
  public function getChildLink() {
    return $this->childLink;
  }
  public function setParentLink(Google_WebpropertyParentLink $parentLink) {
    $this->parentLink = $parentLink;
  }
  public function getParentLink() {
    return $this->parentLink;
  }
  public function setId($id) {
    $this->id = $id;
  }
  public function getId() {
    return $this->id;
  }
  public function setSelfLink($selfLink) {
    $this->selfLink = $selfLink;
  }
  public function getSelfLink() {
    return $this->selfLink;
  }
  public function setAccountId($accountId) {
    $this->accountId = $accountId;
  }
  public function getAccountId() {
    return $this->accountId;
  }
}

class Google_WebpropertyChildLink extends Google_Model {
  public $href;
  public $type;
  public function setHref($href) {
    $this->href = $href;
  }
  public function getHref() {
    return $this->href;
  }
  public function setType($type) {
    $this->type = $type;
  }
  public function getType() {
    return $this->type;
  }
}

class Google_WebpropertyParentLink extends Google_Model {
  public $href;
  public $type;
  public function setHref($href) {
    $this->href = $href;
  }
  public function getHref() {
    return $this->href;
  }
  public function setType($type) {
    $this->type = $type;
  }
  public function getType() {
    return $this->type;
  }
}


text:
"""

Implement the RandomizedSet class:

bool insert(int val) Inserts an item val into the set if not present. Returns true if the item was not present, false otherwise.
bool remove(int val) Removes an item val from the set if present. Returns true if the item was present, false otherwise.
int getRandom() Returns a random element from the current set of elements (it's guaranteed that at least one element exists when this method is called). Each element must have the same probability of being returned.

Follow up: Could you implement the functions of the class with each function works in average O(1) time?

Example 1:

Input
["RandomizedSet", "insert", "remove", "insert", "getRandom", "remove", "insert", "getRandom"]
[[], [1], [2], [2], [], [1], [2], []]
Output
[null, true, false, true, 2, true, false, 2]

Explanation
RandomizedSet randomizedSet = new RandomizedSet();
randomizedSet.insert(1); // Inserts 1 to the set. Returns true as 1 was inserted successfully.
randomizedSet.remove(2); // Returns false as 2 does not exist in the set.
randomizedSet.insert(2); // Inserts 2 to the set, returns true. Set now contains [1,2].
randomizedSet.getRandom(); // getRandom() should return either 1 or 2 randomly.
randomizedSet.remove(1); // Removes 1 from the set, returns true. Set now contains [2].
randomizedSet.insert(2); // 2 was already in the set, so return false.
randomizedSet.getRandom(); // Since 2 is the only number in the set, getRandom() will always return 2.

Constraints:

-231 <= val <= 231 - 1
At most 105 calls will be made to insert, remove, and getRandom.
There will be at least one element in the data structure when getRandom is called.

"""

import random

class RandomizedSet:

    def __init__(self):
        """
        Initialize your data structure here.
        """
        self.nums = []
        self.pos = {}

    def insert(self, val: int) -> bool:
        """
        Inserts a value to the set. Returns true if the set did not already contain the specified element.
        """
        if val not in self.pos:
            index = len(self.nums)
            self.pos[val] = index
            self.nums.append(val)
            return True
        return False

    def remove(self, val: int) -> bool:
        """
        Removes a value from the set. Returns true if the set contained the specified element.
        """
        if val in self.pos:
            index = self.pos[val]
            tail = self.nums[-1]
            self.nums[index] = self.nums[-1]
            self.nums.pop()
            self.pos[tail] = index
            del self.pos[val]
            return True
        return False

    def getRandom(self) -> int:
        """
        Get a random element from the set.
        """
        while True:
            ch = random.choice(self.nums)
            if ch is not None:
                return ch

# Your RandomizedSet object will be instantiated and called as such:
# obj = RandomizedSet()
# param_1 = obj.insert(val)
# param_2 = obj.remove(val)
# param_3 = obj.getRandom()

redpajama_set_name: RedPajamaGithub


text:
<?php

require_once dirname(__FILE__).'/MemcachedConnection.class.php';

/**
 * Gateway to Memcached server.
 *
 * @package repository
 * @subpackage store.memcached
 */
class MemcachedAdaptor {
	private $connection;

	function __construct($connection) {
		$this->connection = $connection;
	}

	/**
	 * Compresses a namespace and key into a single string for referencing as a cache identifier.
	 */
	private function generateCacheKey($namespace, $key) {
		return md5($namespace."--|--".$key);
	}

	/**
	 * Read an object from the data store.
	 */
	function read($namespace, $key) {
		return $this->connection->execute("get", $this->generateCacheKey($namespace, $key));
	}

	/**
	 * Add a record to the cache based on given key.
	 */
	function add($namespace, $key, $data) {
		return $this->connection->execute("add", $this->generateCacheKey($namespace, $key), $data);
	}

	/**
	 * Write an object to the data store.
	 */
	function write($namespace, $key, $data, $expire=30) {
		return $this->connection->execute("set", $this->generateCacheKey($namespace, $key), $data, $expire);
	}

	/**
	 * Clear a record from the cache.
	 */
	function delete($namespace, $key) {
		return $this->connection->execute("delete", $this->generateCacheKey($namespace, $key));
	}

	/**
	 * Return current profile stats from the memcached instance.
	 */
	function getStats($type) {
		return $this->connection->execute("getStats", $type);
	}

	/**
	 * Close down the connection on shutdown.
	 */
	function __destruct() {
		$this->connection->close();
	}

}


text:
/// <reference path="../_refs.ts" />
module MyVote.Directives {
    "use strict";

    MyVote.App.directive("mvInput", () => {

        return {
            replace: false,
            restrict: "E",
            scope: false,
            template: (element, attrs) => {
                var selectTemplate = `<label for=${attrs.name}>${attrs.description}`;

                if (attrs.required) {
                    selectTemplate += ' • ';
                }

                selectTemplate += `</label><input id=${attrs.name} name=${attrs.name} ng-model=${attrs.ngModel} type=${attrs.type}` + ((attrs.required) ? " required=true" : "") + ((attrs.autoFocus) ? " autoFocus=true" : "") + " />";

                selectTemplate += `

`;

                return selectTemplate;

            }

        }

    });

}


text:
template: template.html
---


text:
pub use self::imp::*;

#[cfg(target_os = "linux")]
mod imp {
    use caps::{self, CapSet, Capability};

    /// This is currently the "master check" for whether the Supervisor
    /// can behave "as root".
    ///
    /// All capabilities must be present. If we can run processes as other
    /// users, but can't change ownership, then the processes won't be
    /// able to access their files. Similar logic holds for the reverse.
    pub fn can_run_services_as_svc_user() -> bool {
        has(Capability::CAP_SETUID) && has(Capability::CAP_SETGID) && has(Capability::CAP_CHOWN)
    }

    /// Helper function; does the current thread have `cap` in its
    /// effective capability set?
    fn has(cap: Capability) -> bool {
        caps::has_cap(None, CapSet::Effective, cap).unwrap_or(false)
    }
}

#[cfg(target_os = "macos")]
mod imp {
    pub fn can_run_services_as_svc_user() -> bool {
        true
    }
}


text:
node-ringbuffer
===============

A simple ring buffer implementation based on the basic Buffer class that node.js
provides.  It basically keeps track of the current position in the buffer (mark)
and the remaining bytes based on how much data has been inserted so far.  It will
also automatically "rotate" the buffer to the zero position when the buffer
doesn't have enough free space to put additional data.

The API interacts with Buffers, so you aren't restricted to fixed size: you `put()`
existing Buffers and `get()` bytes placed into a Buffer object you pass in.  This
makes it particularly useful for consuming and managing data from the network if
you are working with your own serialization protocol, which was the initial onus
for this (cracking a proprietary messaging protocol over a TCP connection).

To Do
-----

* Rewrite this as a native node.js library, for performance reasons.


text:
static NSInteger LUScanWidth = 260;

#define LUWidth MainScreenWidth

#define LUHeight MainScreenHeight

// 设置扫描框距离底部的距离
#define LUBottomPedding ((LUHeight - LUScanWidth)/2.0)

//遮盖的颜色
#define LUShadowColor [UIColor colorWithWhite:0.000 alpha:0.550]

@interface KRScanBaseController () <AVCaptureMetadataOutputObjectsDelegate>
{
    int _num;
    BOOL _upOrdown;
    NSTimer *_timer;
}

////一个捕捉视频流的设备  AVMediaTypeVideo视频
//@property (nonatomic, strong) AVCaptureDevice *device;

//// 识别二维码之后的输出数据
//@property (nonatomic, strong) AVCaptureMetadataOutput *output;

// 预览扫描视频的 layer
@property (nonatomic, weak) AVCaptureVideoPreviewLayer *previewLayer;

// 设置扫描的线
@property (nonatomic, weak) UIView *scanLine;

@end

@implementation KRScanBaseController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.edgesForExtendedLayout =  UIRectEdgeNone;

    // 设置背景颜色
    self.view.backgroundColor = [UIColor whiteColor];

    // 设置导航栏的标题
    self.navigationItem.title = @"扫描二维码";

    // 设置扫码硬件
    [self configCapture];

    // 添加子控件
    [self configSubViews];

}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    [self setUpCamera];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];

    [_session stopRunning];
}

- (BOOL)prefersStatusBarHidden
{
    return YES;
}

- (BOOL)shouldAutorotate
{
    return NO;
}

// 开始捕捉视频
- (void)setUpCamera
{
    if (_session) {
        [_session startRunning];
    }
}

#pragma mark ============ 设置扫码硬件 =============
- (void)configCapture {

    NSError *error = nil;
    // Device
    //获取摄像设备
    AVCaptureDevice * device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
    //创建输入流
    AVCaptureDeviceInput * input = [AVCaptureDeviceInput deviceInputWithDevice:device error:&error];
    //创建输出流
    AVCaptureMetadataOutput * output = [[AVCaptureMetadataOutput alloc] init];
    //设置代理 在主线程里刷新
    [output setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];

    //判断有没有获得输入流,如果没有打印错误信息
    if (!input) {
        NSLog(@"%@", [error localizedFailureReason]);

        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"该设备没有可用摄像头或摄像头已损坏" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
        [alert show];
        [self dismissViewControllerAnimated:YES completion:nil];
        return;
    }

    //如果还没有获取过摄像头权限,进行申请获取权限,如果用户拒绝了,就直接退出
    AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
    if (authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied) {
        NSLog(@"没有打开照相机的权限");
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"请在隐私中打开相机权限" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
        [alert show];
        [self dismissViewControllerAnimated:YES completion:nil];
        return;
    }

    // Session 输入输出流中间处理的桥梁
    _session = [[AVCaptureSession alloc] init];

    //设置捕捉到的输出流的分辨率:高(1080p)
    [_session setSessionPreset:AVCaptureSessionPresetPhoto];
    //桥接输入,输出流
    if ([_session canAddInput:input]){
        [_session addInput:input];
    }
    if ([_session canAddOutput:output]){
        [_session addOutput:output];
    }

    self.input = input;

    [_input.device lockForConfiguration:nil];
    _input.device.torchMode = AVCaptureTorchModeOff;
    [_input.device unlockForConfiguration];

    // 条码类型 AVMetadataObjectTypeQRCode(二维码,条形码)
    output.metadataObjectTypes = @[AVMetadataObjectTypeQRCode,AVMetadataObjectTypeEAN13Code, AVMetadataObjectTypeEAN8Code, AVMetadataObjectTypeCode128Code];

    // Preview 预览视频的layer
    AVCaptureVideoPreviewLayer *previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:self.session];

    //layer的填充方式
    previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
    previewLayer.frame = CGRectMake(0, 0, LUWidth, LUHeight);

    //将预览视频的layer插入到self.view.layer的上面.显示出来
    [self.view.layer insertSublayer:previewLayer atIndex:0];
    self.previewLayer = previewLayer;

    //计算 rectOfInterest :代表我们识别二维码的区域.
    //圆角的二维码和被挡住一部分的二维码特别难以识别,缩小识别方位可以提升识别速度.
    //注意x,y交换位置
    //_output 的rectOfInterest,是以图片的形式识别二维码的,图片是横向的,而手机屏幕是竖着的,所以x和y是反向的,宽和高也是反向的.(x,y,width,height)四个值得范围都是0-1之间,按照比例进行换算.
    [output setRectOfInterest:CGRectMake((LUHeight - LUBottomPedding - LUScanWidth)/ LUHeight ,(LUWidth - LUScanWidth) / 2/ LUWidth , LUScanWidth / LUHeight , LUScanWidth / LUWidth)];

}

#pragma mark ============= 添加子控件 =============
- (void)configSubViews
{
    // 创建遮盖
    CGFloat topHeight = self.hasNavigationBar == NO ? (LUHeight - LUScanWidth - LUBottomPedding) : (LUHeight - LUScanWidth - LUBottomPedding - 64);
    CGFloat bottomY = self.hasNavigationBar == NO ? (LUHeight - LUBottomPedding) : (LUHeight - LUBottomPedding - 64);

    //新建一个layer,遮住左边
    [self createBackLayerWithFrame:CGRectMake(0, 0, (LUWidth - LUScanWidth) / 2, LUHeight)];
    //遮住右边
    [self createBackLayerWithFrame:CGRectMake((LUWidth - LUScanWidth) / 2 + LUScanWidth, 0, (LUWidth - LUScanWidth) / 2, LUHeight)];
    //遮住上边
    [self createBackLayerWithFrame:CGRectMake((LUWidth - LUScanWidth) / 2, 0, LUScanWidth, topHeight)];
    //遮住下边
    [self createBackLayerWithFrame:CGRectMake((LUWidth - LUScanWidth) / 2, bottomY, LUScanWidth, LUBottomPedding)];

    UILabel *label = [[UILabel alloc] init];
    [self.view addSubview:label];
    label.frame = CGRectMake(0, bottomY, MainScreenWidth, 40);
    label.text = @"将取景框对准二维码即可自动扫描";
    label.font = [UIFont systemFontOfSize:12];
    label.textAlignment = NSTextAlignmentCenter;
    label.textColor = [UIColor whiteColor];
    label.numberOfLines = 2;

    // 创建打开闪光灯按钮
    UIButton *shanBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [shanBtn setTitle:@"闪光灯" forState:UIControlStateNormal];
    [self.view addSubview:shanBtn];
    [shanBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(@(-48));
        make.left.equalTo(@(16));
        make.height.equalTo(@(38));
        make.width.equalTo(@(60));
    }];
    [shanBtn addTarget:self action:@selector(shanClick:) forControlEvents:UIControlEventTouchUpInside];

    // 创建扫描区域的imageview
    UIImageView *borderImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ScanBorder"]];
    [self.view addSubview:borderImage];
    borderImage.frame = CGRectMake((MainScreenWidth - LUScanWidth) / 2.0, topHeight, LUScanWidth, LUScanWidth);

    // 创建上下扫描的线
    UIView *scanLine = [[UIView alloc] init];
    scanLine.backgroundColor = [UIColor colorWithRed:0.000 green:1.000 blue:0.000 alpha:0.717];
    [borderImage addSubview:scanLine];
    scanLine.frame = CGRectMake(5, 0, borderImage.frame.size.width-10, 2);
    self.scanLine = scanLine;

    _upOrdown = NO;
    _num = 0;

    //执行动画
    _timer = [NSTimer scheduledTimerWithTimeInterval:0.02 target:self selector:@selector(animation) userInfo:nil repeats:YES];
}

//执行的动画
- (void)animation {
    if (_upOrdown == NO) {
        _num ++;
        CGPoint center = _scanLine.center;
        center.y += 2;
        _scanLine.center = center;
        if (2 * _num == LUScanWidth - 4) {
            _upOrdown = YES;
        }
    }
    else {
        _num --;
        CGPoint center = _scanLine.center;
        center.y -= 2;
        _scanLine.center = center;
        if (_num == 2) {
            _upOrdown = NO;
        }
    }
}

// 手电筒开关
- (void)shanClick:(UIButton *)button
{

    AVCaptureTorchMode torch = self.input.device.torchMode;
    switch (_input.device.torchMode) {
        case AVCaptureTorchModeAuto:
            [button setTitle:@"闪光灯(开)" forState:UIControlStateNormal];
            torch = AVCaptureTorchModeOn;
            break;
        case AVCaptureTorchModeOff:
            [button setTitle:@"闪光灯(开)" forState:UIControlStateNormal];
            torch = AVCaptureTorchModeOn;
            break;
        case AVCaptureTorchModeOn:
            [button setTitle:@"闪光灯(关)" forState:UIControlStateNormal];
            torch = AVCaptureTorchModeOff;
            break;
        default:
            break;
    }

    //在配置摄像头的相关属性之前,必须先调用lockForConfiguration:方法执行锁定,配置完成后调用unlockForConfiguration方法解锁。
    [_input.device lockForConfiguration:nil];
    _input.device.torchMode = torch;
    [_input.device unlockForConfiguration];
}

#pragma mark ============= 添加遮盖 =============
- (void)createBackLayerWithFrame:(CGRect)frame{
    CALayer *backLayer = [CALayer layer];
    backLayer.frame = frame;
    backLayer.backgroundColor = LUShadowColor.CGColor;
    [self.view.layer addSublayer:backLayer];
}

#pragma mark - AVCaptureMetadataOutputObjectsDelegate
// 当扫描到数据的时候,调用代理的方法,获取数据,显示在 resultLabel上
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection
{
    NSString *stringValue;
    if (metadataObjects != nil && [metadataObjects count] > 0)
    {
        AVMetadataMachineReadableCodeObject * metadataObject = [metadataObjects objectAtIndex:0];
        stringValue = metadataObject.stringValue;

        // 操作获得的string
        [self operationWithString:stringValue];
        [_session stopRunning];

    }else {

    }
}

#pragma mark ============= 这里对获得的string进行操作 =============
- (void)operationWithString:(NSString *)string
{
    NSLog(@"base扫描到的数据是: %@", string);
    __weak typeof(self) weakSelf = self;
    [self dismissViewControllerAnimated:YES completion:^{
        if (weakSelf.getStringBlock) {
            weakSelf.getStringBlock(string);
        }
    }];
}

- (void)dealloc {

    [_session stopRunning];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

@end


text:
require 'net/ssh/proxy/command'
server ENV['PRODUCTION_SERVER'], user: ENV['PRODUCTION_USER'], roles: %w(web app db)
set :ssh_options, proxy: Net::SSH::Proxy::Command.new("ssh #{ENV['GATEWAY']} -W %h:%p")
set :branch, 'master'


text:
from django.conf.urls import patterns, include, url

from django.contrib import admin
admin.autodiscover()

from rest_framework import routers
from server.views import UserViewSet, DestinationViewSet, BackupViewSet

# Routers provide a way of automatically determining the URL conf.
router = routers.DefaultRouter()
router.register(r'users', UserViewSet)
router.register(r'destinations', DestinationViewSet)
router.register(r'backups', BackupViewSet)

from rest_framework.authtoken.views import obtain_auth_token

urlpatterns = patterns('',
    url(r'^admin/', include(admin.site.urls), name='admin'),
    url(r'^', include(router.urls)),
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
    url(r'^api-token-auth/', obtain_auth_token),
    url(r'^docs/', include('rest_framework_swagger.urls')),
)


text:
"""Layers in jraph/flax."""

from typing import Any, Callable
from flax import linen as nn
import jax
import jax.numpy as jnp

class PReLU(nn.Module):
  """A PReLU Layer."""
  init_fn: Callable[[Any], Any] = nn.initializers.uniform()

  @nn.compact
  def __call__(self, x):
    leakage = self.param('leakage', self.init_fn, [1])
    return jnp.maximum(0, x) + leakage * jnp.minimum(0, x)

class Activation(nn.Module):
  """Activation function."""
  activation: str

  def setup(self):
    if self.activation == 'ReLU':
      self.act_fn = nn.relu
    elif self.activation == 'SeLU':
      self.act_fn = jax.nn.selu
    elif self.activation == 'PReLU':
      self.act_fn = PReLU()
    else:
      raise 'Activation not recognized'

  def __call__(self, x):
    return self.act_fn(x)

class Bilinear(nn.Module):
  """A Bilinear Layer."""
  init_fn: Callable[[Any], Any] = nn.initializers.normal()

  @nn.compact
  def __call__(self, x_l, x_r):
    kernel = self.param('kernel', self.init_fn, [x_l.shape[-1], x_r.shape[-1]])
    return x_l @ kernel @ jnp.transpose(x_r)

class EucCluster(nn.Module):
  """Learnable KMeans Clustering."""
  num_reps: int
  init_fn: Callable[[Any], Any] = nn.initializers.normal()

  @nn.compact
  def __call__(self, x):
    centers = self.param('centers', self.init_fn, [self.num_reps, x.shape[-1]])
    dists = jnp.sqrt(pairwise_sqeuc_dists(x, centers))
    return jnp.argmin(dists, axis=0), jnp.min(dists, axis=1), centers

@jax.jit
def dgi_readout(node_embs):
  return jax.nn.sigmoid(jnp.mean(node_embs, axis=0))

def subtract_mean(embs):
  return embs - jnp.mean(embs, axis=0)

def divide_by_l2_norm(embs):
  norm = jnp.linalg.norm(embs, axis=1, keepdims=True)
  return embs / norm

@jax.jit
def normalize(node_embs):
  return divide_by_l2_norm(subtract_mean(node_embs))

@jax.jit
def pairwise_sqeuc_dists(x, y):
  """Pairwise square Euclidean distances."""
  n = x.shape[0]
  m = y.shape[0]
  x_exp = jnp.expand_dims(x, axis=1).repeat(m, axis=1).reshape(n * m, -1)
  y_exp = jnp.expand_dims(y, axis=0).repeat(n, axis=0).reshape(n * m, -1)
  return jnp.sum(jnp.power(x_exp - y_exp, 2), axis=1).reshape(n, m)


text:
import sys
import numpy as np
import os
from os import path

class DependencyWriter:
    """
    Dependency writer class
    """

    def __init__(self):
        pass

    def save(self, language, heads_pred):
        """Saves predicted dependency trees."""
        base_deppars_dir = path.join(path.dirname(__file__), "..", "..", "data", "deppars")
        languages = ["danish", "dutch", "portuguese", "english"]
        i = 0
        word_dict = {}
        pos_dict = {}
        feat_counts = {}
        if language not in languages:
            print("Language does not exist: \"%s\": Available are: %s" % (language, languages))
            return

        # Load test data
        n_toks = 0
        n_sents = 0
        conll_file = open(path.join(base_deppars_dir, language + "_test.conll"))
        conll_file_out = open(path.join(base_deppars_dir, language + "_test.conll.pred"), 'w')
        for line in conll_file:
            line = line.rstrip()
            if len(line) == 0:
                n_toks = 0
                n_sents += 1
                conll_file_out.write("\n")
                continue
            fields = line.split("\t")

            fields[6] = "{0}".format(heads_pred[n_sents][n_toks+1])
            line_out = "\t".join(fields)
            n_toks += 1

            conll_file_out.write(line_out)
            conll_file_out.write("\n")

        conll_file_out.close()
        conll_file.close()


text:
<?xml version="1.0" encoding="UTF-8" ?>

<schema name="fusion-roles" version="1.5">
	<fields>
		<field name="role"		type="string_ci"		indexed="true"	stored="true"/>
		<field name="count"	type="int"	indexed="true"	stored="true"	docValues="true"/>
		<field name="genome_cout"	type="int"		indexed="true"	stored="true"	docValues="true"/>
		<field name="fusion_count"	type="int"	indexed="true"	stored="true"	docValues="true"/>
		<field name="fused_genome_count"	type="int"	indexed="true"	stored="true"	docValues="true"/>
		<field name="fraction_of_genes_fused"	type="float"	indexed="true"	stored="true"	docValues="true"/>
		<field name="fraction_of_genomes_fused"	type="float"	indexed="true"	stored="true"	docValues="true"/>
		<field name="score"	type="float"	indexed="true"	stored="true"	docValues="true"/>
		<field name="subsystem"	type="string_ci"	indexed="true"	stored="true"	docValues="true"/>
		<field name="class_one"	type="string_ci"	indexed="true"	stored="true"	docValues="true"/>
		<field name="class_two"	type="string_ci"	indexed="true"	stored="true"	docValues="true"/>
		<field name="frequently_fused_function_count"	type="int"	indexed="true"	stored="true"	docValues="true"/>
		<field name="frequently_fused_function_genomes"	type="float"	indexed="true"	stored="true"	docValues="true"/>

		<field name="text"		type="text_custom"	indexed="true"	stored="false"	multiValued="true" />
		<field name="_version_"		type="long"		indexed="true"	stored="true" />
	</fields>

	<uniqueKey>role</uniqueKey>

	<solrQueryParser defaultOperator="AND"/>

	<xi:include href="schema_types.xml" xmlns:xi="http://www.w3.org/2001/XInclude">
		<xi:fallback></xi:fallback>
	</xi:include>
</schema>


text:
<?php

namespace Mcuser\Factory;

use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Mcuser\Authentication\Identity\Database;

class IdentityFactory implements FactoryInterface
{

    public function createService(ServiceLocatorInterface $sl)
    {
        $pageOptions = $sl->get('User\PageOptions');
        return new Database($sl->get($pageOptions->getAppOption('entitymanager')));
    }
}


text:
<?php

namespace Krystal\Db\Sql;

interface QueryObjectInterface
{
    /**
     * Returns a name of selected table
     *
     * @throws \LogicException if no table is selected
     * @return string
     */
    public function getSelectedTable();

    /**
     * Returns a word with wildcard. Can be used for LIKE constraints
     *
     * @param string $target
     * @param string $type
     * @throws \RuntimeException if unknown type supplied
     * @return string
     */
    public function getWithWildcart($target, $type = self::LIKE_RAW);

    /**
     * Checks whether it's worth filtering
     *
     * @param boolean $state
     * @param string|array $target
     * @return boolean
     */
    public function isFilterable($state, $target);

    /**
     * Guesses count query
     *
     * @param string $column Column to be selected
     * @param string $alias
     * @return string Guessed query
     */
    public function guessCountQuery($column, $alias);

    /**
     * Sets query raw string
     *
     * @param string $queryString
     * @return void
     */
    public function setQueryString($queryString);

    /**
     * Returns current query string
     *
     * @return string
     */
    public function getQueryString();

    /**
     * Clears the query string
     *
     * @return \Krystal\Db\Sql\QueryBuilder
     */
    public function clear();
}


text:
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

import { upload } from '../lib/api';

import '../../node_modules/react-quill/dist/quill.snow.css';

/*
 * Simple editor component that takes placeholder text as a prop
 */
class HTMLEditor extends React.Component {
  static propTypes = {
    placeholder: PropTypes.string,
    defaultValue: PropTypes.string,
    className: PropTypes.string,
    onChange: PropTypes.func,
  };

  constructor(props) {
    super(props);
    this.state = { editorHtml: props.defaultValue, theme: 'snow' };
    this.handleChange = this.handleChange.bind(this);
    this.saveToServer = this.saveToServer.bind(this);
    this.insertToEditor = this.insertToEditor.bind(this);
    if (typeof window !== 'undefined') {
      this.ReactQuill = require('react-quill');
    }

    /*
     * Quill modules to attach to editor
     * See https://quilljs.com/docs/modules/ for complete options
     */
    this.modules = {
      toolbar: {
        container: [
          [{ header: '1' }, { header: '2' }],
          [{ size: [] }],
          ['bold', 'italic', 'underline', 'blockquote'],
          [{ list: 'ordered' }, { list: 'bullet' }],
          ['link', 'image', 'video'],
        ],
        handlers: {
          image: () => {
            this.selectLocalImage();
          },
        },
      },
      clipboard: {
        // toggle to add extra line breaks when pasting HTML:
        matchVisual: false,
      },
    };
    /*
     * Quill editor formats
     * See https://quilljs.com/docs/formats/
     */
    this.formats = [
      'header',
      'font',
      'size',
      'bold',
      'italic',
      'underline',
      'strike',
      'blockquote',
      'list',
      'bullet',
      'indent',
      'link',
      'image',
      'video',
    ];
  }

  componentDidUpdate(oldProps) {
    if (this.props.value !== oldProps.value) {
      this.setState({ editorHtml: this.props.value });
    }
  }

  handleChange(html) {
    this.setState({ editorHtml: html });
    this.props.onChange(html);
  }

  selectLocalImage() {
    const input = document.createElement('input');
    input.setAttribute('type', 'file');
    input.click();

    // Listen upload local image and save to server
    input.onchange = () => {
      const file = input.files[0];

      // file type is only image.
      if (/^image\//.test(file.type)) {
        this.saveToServer(file);
      } else {
        console.warn('You can only upload images.');
      }
    };
  }

  /**
   * Step2. save to server
   *
   * @param {File} file
   */
  saveToServer(file) {
    upload(file)
      .then(fileUrl => {
        return this.insertToEditor(fileUrl);
      })
      .catch(e => {
        console.error('Error uploading image', e);
      });
  }

  /**
   * Step3. insert image url to rich editor.
   *
   * @param {string} url
   */
  insertToEditor(url) {
    const editor = this.reactQuillRef.getEditor();
    // push image url to rich editor.
    const range = editor.getSelection();
    editor.insertEmbed(range.index, 'image', url);
  }

  render() {
    if (!this.ReactQuill) {
      return <div />;
    }

    return (
      <div className={classNames('HTMLEditor', this.props.className)}>
        <style jsx>
          {`
            .HTMLEditor :global(.quill) {
              height: auto;
            }
            .HTMLEditor :global(.ql-container) {
              min-height: 20rem;
              max-height: 35rem;
              overflow-y: auto;
            }
            .HTMLEditor.small :global(.quill) {
              height: auto;
              min-height: 20rem;
            }
            .HTMLEditor.small :global(.ql-container) {
              height: 15rem;
            }
          `}
        </style>
        <this.ReactQuill
          ref={el => (this.reactQuillRef = el)}
          theme="snow"
          onChange={this.handleChange}
          value={this.state.editorHtml || ''}
          defaultValue={this.props.defaultValue || ''}
          modules={this.modules}
          formats={this.formats}
          bounds={'.app'}
          placeholder={this.props.placeholder}
        />
      </div>
    );
  }
}

// // quill editor add image handler
// HTMLEditor.getModule('toolbar').addHandler('image', () => {
//   selectLocalImage();
// });

export default HTMLEditor;


text:
package com.github.nmorel.gwtjackson.client.deser.collection;

import java.util.AbstractCollection;
import java.util.ArrayList;

import com.github.nmorel.gwtjackson.client.JsonDeserializer;

/**
 * Default {@link JsonDeserializer} implementation for {@link AbstractCollection}. The deserialization process returns an {@link ArrayList}.
 *
 * @param <T> Type of the elements inside the {@link AbstractCollection}
 * @author Nicolas Morel
 * @version $Id: $
 */
public class AbstractCollectionJsonDeserializer<T> extends BaseCollectionJsonDeserializer<AbstractCollection<T>, T> {

    /**
     *
newInstance

     *
     * @param deserializer {@link JsonDeserializer} used to deserialize the objects inside the {@link AbstractCollection}.
     * @param <T> Type of the elements inside the {@link AbstractCollection}
     * @return a new instance of {@link AbstractCollectionJsonDeserializer}
     */
    public static <T> AbstractCollectionJsonDeserializer<T> newInstance( JsonDeserializer<T> deserializer ) {
        return new AbstractCollectionJsonDeserializer<T>( deserializer );
    }

    /**
     * @param deserializer {@link JsonDeserializer} used to deserialize the objects inside the {@link AbstractCollection}.
     */
    private AbstractCollectionJsonDeserializer( JsonDeserializer<T> deserializer ) {
        super( deserializer );
    }

    /** {@inheritDoc} */
    @Override
    protected AbstractCollection<T> newCollection() {
        return new ArrayList<T>();
    }
}


text:
'use strict';
angular.module('datatablesSampleApp').controller('angularWayCtrl', function ($scope, $resource) {
    $scope.persons = $resource('data.json').query();
});


text:
New-PSDrive -PSProvider registry -Root "HKEY_CLASSES_ROOT" -Name "HKCR"

$background_shell_path = "HKCR:\Directory\Background\shell"
$shell_name = "Alacritty"
New-Item -Path $background_shell_path -Name $shell_name

$alacritty_path = Join-Path -Path $background_shell_path -ChildPath $shell_name

New-ItemProperty -LiteralPath $alacritty_path -name '(Default)' -Value "Open Alacritty Here"

$alacritty_command = "C:\tools\alacritty\alacritty.exe"
$command_path = Join-Path -Path $alacritty_path -ChildPath "command"
New-Item -Path $alacritty_path -Name "command"
New-ItemProperty -LiteralPath $command_path -name '(Default)' -Value $alacritty_command


text:
Walkdir gives the full path for each file so I have to remove the input dir part.

{%code_ref
    "src" : "src/markdown-parser/markdown-reader.ts",
    "ref" : {
        "text" : "file.substr(dirNameLength + 1).match(mdre)"
    }
%}

**Warning:**
I don't like the fact that this is here, its implying that it has 1-1 relation with the metadata saved
{:.alert .alert-danger }

{%code_warning
    "src" : "src/markdown-parser/markdown-file-reader.ts",
    "ref" : {
        "text" : "Object.defineProperty(ref, 'jsonml', {enumerable: false});"
    }
%}

Improve the error handling when the block is not valid JSON

{%code_todo
    "src" : "src/markdown-parser/markdown-file-reader.ts",
    "priority" : 3,
    "ref" : {
        "text" : "const attr = JSON.parse"
    }
%}


text:
import * as improbable_grpcweb_test_test_pb from "../../../improbable/grpcweb/test/test_pb";
import * as google_protobuf_empty_pb from "google-protobuf/google/protobuf/empty_pb";
export class TestService {
  static serviceName = "improbable.grpcweb.test.TestService";
}
export namespace TestService {
  export class PingEmpty {
    static readonly methodName = "PingEmpty";
    static readonly service = TestService;
    static readonly requestStream = false;
    static readonly responseStream = false;
    static readonly requestType = google_protobuf_empty_pb.Empty;
    static readonly responseType = improbable_grpcweb_test_test_pb.PingResponse;
  }
  export class Ping {
    static readonly methodName = "Ping";
    static readonly service = TestService;
    static readonly requestStream = false;
    static readonly responseStream = false;
    static readonly requestType = improbable_grpcweb_test_test_pb.PingRequest;
    static readonly responseType = improbable_grpcweb_test_test_pb.PingResponse;
  }
  export class PingError {
    static readonly methodName = "PingError";
    static readonly service = TestService;
    static readonly requestStream = false;
    static readonly responseStream = false;
    static readonly requestType = improbable_grpcweb_test_test_pb.PingRequest;
    static readonly responseType = google_protobuf_empty_pb.Empty;
  }
  export class PingList {
    static readonly methodName = "PingList";
    static readonly service = TestService;
    static readonly requestStream = false;
    static readonly responseStream = true;
    static readonly requestType = improbable_grpcweb_test_test_pb.PingRequest;
    static readonly responseType = improbable_grpcweb_test_test_pb.PingResponse;
  }
}
export class TestUtilService {
  static serviceName = "improbable.grpcweb.test.TestUtilService";
}
export namespace TestUtilService {
  export class ContinueStream {
    static readonly methodName = "ContinueStream";
    static readonly service = TestUtilService;
    static readonly requestStream = false;
    static readonly responseStream = false;
    static readonly requestType = improbable_grpcweb_test_test_pb.ContinueStreamRequest;
    static readonly responseType = google_protobuf_empty_pb.Empty;
  }
  export class CheckStreamClosed {
    static readonly methodName = "CheckStreamClosed";
    static readonly service = TestUtilService;
    static readonly requestStream = false;
    static readonly responseStream = false;
    static readonly requestType = improbable_grpcweb_test_test_pb.CheckStreamClosedRequest;
    static readonly responseType = improbable_grpcweb_test_test_pb.CheckStreamClosedResponse;
  }
}
export class FailService {
  static serviceName = "improbable.grpcweb.test.FailService";
}
export namespace FailService {
  export class NonExistant {
    static readonly methodName = "NonExistant";
    static readonly service = FailService;
    static readonly requestStream = false;
    static readonly responseStream = false;
    static readonly requestType = improbable_grpcweb_test_test_pb.PingRequest;
    static readonly responseType = improbable_grpcweb_test_test_pb.PingResponse;
  }
}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Bowman, J. P. , Sly, L. I. , Nichols, P. D. , and Hayward, A. C. "Revised taxonomy of the methanotrophs: description of Methylobacter gen. nov. , emendation of Methylococcus, validation of Methylosinus and Methylocystis species, and a proposal that the family Methylococcaceae includes only the group I methanotrophs. " Int. J. Syst. Bacteriol. (1993) 43:735-753.

#### Original name
null

### Remarks
null


text:
using System;
using CoreMessageBus.Configuration;
using CoreMessageBus.Internal;
using JetBrains.Annotations;
using Microsoft.Extensions.DependencyInjection;

namespace CoreMessageBus
{
    public static class Extensions
    {
        public static IServiceCollection AddMessageBus([NotNull] this IServiceCollection services,
            [NotNull] Action<MessageBusConfiguration> configurationAction)
        {
            if (services == null) throw new ArgumentNullException(nameof(services));
            if (configurationAction == null) throw new ArgumentNullException(nameof(configurationAction));

            var configuration = new MessageBusConfiguration();
            configurationAction(configuration);
            services.AddSingleton(configuration);
            services
                .AddScoped<MessageHandlerRegistry>(s => s.GetService<MessageBusConfiguration>().Registry)
                .AddScoped<IMessageHandlerResolver, MessageHandlerResolver>()
                .AddScoped<IMessageHandlerFactory, MessageHandlerFactory>()
                .AddScoped<IMessageBus, MessageBus>();

            return services;
        }
    }
}