<commit_before>#--
# Copyright 2014 Google Inc. All rights reserved.
#
# 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.

require "gcloud"
require "gcloud/storage/project"

#--
# Google Cloud Storage
module Gcloud
  ##
  # Creates a new object for connecting to the Storage service.
  # Each call creates a new connection.
  #
  # === Parameters
  #
  # +project+::
  #   Project identifier for the Storage service you are connecting to.
  #   (+String+)
  # +keyfile+::
  #   Keyfile downloaded from Google Cloud. If file path the file must be
  #   readable. (+String+ or +Hash+)
  #
  # === Returns
  #
  # Gcloud::Storage::Project
  #
  # === Example
  #
  #   require "glcoud/storage"
  #
  #   storage = Gcloud.storage "my-todo-project",
  #                            "/path/to/keyfile.json"
  #
  #   bucket = storage.bucket "my-bucket"
  #   file = bucket.file "path/to/my-file.ext"
  #
  def self.storage project = nil, keyfile = nil
    project ||= Gcloud::Storage::Project.default_project
    if keyfile.nil?
      credentials = Gcloud::Storage::Credentials.default
    else
      credentials = Gcloud::Storage::Credentials.new keyfile
    end
    Gcloud::Storage::Project.new project, credentials
  end

  ##
  # = Google Cloud Storage
  #
  # Google Cloud Storage is an Internet service to store data in Google's cloud.
  # It allows world-wide storage and retrieval of any amount of data and at any
  # time, taking advantage of Google's own reliable and fast networking
  # infrastructure to perform data operations in a cost effective manner.
  #
  # Gcloud's goal is to provide a API that is familiar and comfortable to
  # Rubyists. Authentication is handled by Gcloud.storage. You can provide the
  # project and credential information to connect to the Storage service, or if
  # you are running on Google Compute Engine this configuration is taken care
  # of for you.
  #
  #   require "glcoud/storage"
  #
  #   storage = Gcloud.storage "my-todo-project",
  #                            "/path/to/keyfile.json"
  #
  #   bucket = storage.bucket "my-bucket"
  #   file = bucket.file "path/to/my-file.ext"
  #
  # You can learn more about various options for connection on the
  # {Authentication Guide}[link:AUTHENTICATION.md].
  #
  # To learn more about Datastore, read the
  # {Google Cloud Storage Overview
  # }[https://cloud.google.com/storage/docs/overview].
  #
  # == Retrieving Buckets<commit_msg>Fix typo on Gcloud::Storage documentation<commit_after>#--
# Copyright 2014 Google Inc. All rights reserved.
#
# 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.

require "gcloud"
require "gcloud/storage/project"

#--
# Google Cloud Storage
module Gcloud
  ##
  # Creates a new object for connecting to the Storage service.
  # Each call creates a new connection.
  #
  # === Parameters
  #
  # +project+::
  #   Project identifier for the Storage service you are connecting to.
  #   (+String+)
  # +keyfile+::
  #   Keyfile downloaded from Google Cloud. If file path the file must be
  #   readable. (+String+ or +Hash+)
  #
  # === Returns
  #
  # Gcloud::Storage::Project
  #
  # === Example
  #
  #   require "glcoud/storage"
  #
  #   storage = Gcloud.storage "my-todo-project",
  #                            "/path/to/keyfile.json"
  #
  #   bucket = storage.bucket "my-bucket"
  #   file = bucket.file "path/to/my-file.ext"
  #
  def self.storage project = nil, keyfile = nil
    project ||= Gcloud::Storage::Project.default_project
    if keyfile.nil?
      credentials = Gcloud::Storage::Credentials.default
    else
      credentials = Gcloud::Storage::Credentials.new keyfile
    end
    Gcloud::Storage::Project.new project, credentials
  end

  ##
  # = Google Cloud Storage
  #
  # Google Cloud Storage is an Internet service to store data in Google's cloud.
  # It allows world-wide storage and retrieval of any amount of data and at any
  # time, taking advantage of Google's own reliable and fast networking
  # infrastructure to perform data operations in a cost effective manner.
  #
  # Gcloud's goal is to provide a API that is familiar and comfortable to
  # Rubyists. Authentication is handled by Gcloud.storage. You can provide the
  # project and credential information to connect to the Storage service, or if
  # you are running on Google Compute Engine this configuration is taken care
  # of for you.
  #
  #   require "glcoud/storage"
  #
  #   storage = Gcloud.storage "my-todo-project",
  #                            "/path/to/keyfile.json"
  #
  #   bucket = storage.bucket "my-bucket"
  #   file = bucket.file "path/to/my-file.ext"
  #
  # You can learn more about various options for connection on the
  # {Authentication Guide}[link:AUTHENTICATION.md].
  #
  # To learn more about Cloud Storage, read the
  # {Google Cloud Storage Overview
  # }[https://cloud.google.com/storage/docs/overview].
  #
  # == Retrieving Buckets
{'fraction_non_alphanumeric': 0.09421768707482993, 'fraction_numerical': 0.0027210884353741495, 'mean_word_length': 3.08970792767733, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4853732', 'n_tokens_mistral': 1694, 'n_tokens_neox': 1667, 'n_words': 636}