<commit_before>require_relative "../MiqDisk"
require 'ostruct'

module AzureBlobDisk
  # The maximum read length that supports MD5 return.
  MAX_READ_LEN = 1024 * 1024 * 4

  def self.new(svc, blob_uri, dInfo = nil)
    d_info = dInfo || OpenStruct.new
    d_info.storage_acct_svc = svc
    d_info.blob_uri         = blob_uri
    d_info.fileName         = blob_uri

    MiqDisk.new(self, d_info, 0)
  end

  def d_init
    @diskType         = "azure-blob"
    @blockSize        = 512
    @blob_uri         = @dInfo.blob_uri
    @storage_acct_svc = @dInfo.storage_acct_svc

    uri_info   = @storage_acct_svc.parse_uri(@blob_uri)
    @container = uri_info[:container]
    @blob      = uri_info[:blob]
    @acct_name = uri_info[:account_name]
    @snapshot  = uri_info[:snapshot]

    @storage_acct = @storage_acct_svc.accounts_by_name[@acct_name]
    raise "AzureBlob: Storage account #{@acct_name} not found." unless @storage_acct

    $log.debug "AzureBlobDisk: open(#{@blob_uri})"
    @t0 = Time.now
    @reads = 0
    @bytes = 0
    @split_reads = 0
  end

  def d_close
    return nil unless $log.debug?
    t1 = Time.now
    $log.debug "AzureBlobDisk: close(#{@blob_uri})"
    $log.debug "AzureBlobDisk: (#{@blob_uri}) time:  #{t1 - @t0}"<commit_msg>Rubocop cleanup.<commit_after>require_relative "../MiqDisk"
require 'ostruct'

module AzureBlobDisk
  # The maximum read length that supports MD5 return.
  MAX_READ_LEN = 1024 * 1024 * 4

  def self.new(svc, blob_uri, dInfo = nil)
    d_info = dInfo || OpenStruct.new
    d_info.storage_acct_svc = svc
    d_info.blob_uri         = blob_uri
    d_info.fileName         = blob_uri

    MiqDisk.new(self, d_info, 0)
  end

  def d_init
    @diskType         = "azure-blob"
    @blockSize        = 512
    @blob_uri         = @dInfo.blob_uri
    @storage_acct_svc = @dInfo.storage_acct_svc

    uri_info   = @storage_acct_svc.parse_uri(@blob_uri)
    @container = uri_info[:container]
    @blob      = uri_info[:blob]
    @acct_name = uri_info[:account_name]
    @snapshot  = uri_info[:snapshot]

    @storage_acct = @storage_acct_svc.accounts_by_name[@acct_name]
    raise "AzureBlob: Storage account #{@acct_name} not found." unless @storage_acct

    $log.debug "AzureBlobDisk: open(#{@blob_uri})"
    @t0 = Time.now.to_i
    @reads = 0
    @bytes = 0
    @split_reads = 0
  end

  def d_close
    return nil unless $log.debug?
    t1 = Time.now.to_i
    $log.debug "AzureBlobDisk: close(#{@blob_uri})"
    $log.debug "AzureBlobDisk: (#{@blob_uri}) time:  #{t1 - @t0}"
{'fraction_non_alphanumeric': 0.11692429647245343, 'fraction_numerical': 0.016646848989298454, 'mean_word_length': 2.9873617693522907, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1076635', 'n_tokens_mistral': 991, 'n_tokens_neox': 947, 'n_words': 192}