<commit_before># encoding: UTF-8
#
# Copyright 2015 <NAME> <<EMAIL>>
#
# 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 'English'
require 'zip'
require 'fileutils'
require 'pathname'

module WinRM
  module FS
    module Core
      # Temporary zip file on the local system
      class TempZipFile
        attr_reader :zip_file, :path, :paths, :basedir, :options

        # Creates a new local temporary zip file
        # @param [String] Base directory to use when expanding out files passed to add
        # @param [Hash] Options: zip_file, via, recurse_paths
        def initialize(basedir = Dir.pwd, options = {})
          @basedir = Pathname.new(basedir)
          @options = options
          @zip_file = options[:zip_file] || Tempfile.new(['winrm_upload', '.zip'])
          @path = Pathname.new(@zip_file)
        end

        # Adds a file or directory to the temporary zip file
        # @param [String] Directory or file path relative to basedir to add into zip
        def add(*new_paths)
          new_paths.each do | path |
            absolute_path = File.expand_path(path, basedir)
            fail "#{path} must exist relative to #{basedir}" unless File.exist? absolute_path
            paths << Pathname.new(absolute_path).relative_path_from(basedir)
          end
        end

        def paths
          @paths ||= []
        end

        def delete
          @zip_file.delete
        end
<commit_msg>Close handle or zip can't create (/fill) that file<commit_after># encoding: UTF-8
#
# Copyright 2015 <NAME> <<EMAIL>>
#
# 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 'English'
require 'zip'
require 'fileutils'
require 'pathname'

module WinRM
  module FS
    module Core
      # Temporary zip file on the local system
      class TempZipFile
        attr_reader :zip_file, :path, :paths, :basedir, :options

        # Creates a new local temporary zip file
        # @param [String] Base directory to use when expanding out files passed to add
        # @param [Hash] Options: zip_file, via, recurse_paths
        def initialize(basedir = Dir.pwd, options = {})
          @basedir = Pathname.new(basedir)
          @options = options
          @zip_file = options[:zip_file] || Tempfile.new(['winrm_upload', '.zip'])
          @zip_file.close unless @zip_file.respond_to?('closed?') && @zip_file.closed?
          @path = Pathname.new(@zip_file)
        end

        # Adds a file or directory to the temporary zip file
        # @param [String] Directory or file path relative to basedir to add into zip
        def add(*new_paths)
          new_paths.each do | path |
            absolute_path = File.expand_path(path, basedir)
            fail "#{path} must exist relative to #{basedir}" unless File.exist? absolute_path
            paths << Pathname.new(absolute_path).relative_path_from(basedir)
          end
        end

        def paths
          @paths ||= []
        end

        def delete
          @zip_file.delete
        end

{'fraction_non_alphanumeric': 0.08585095669687814, 'fraction_numerical': 0.004531722054380665, 'mean_word_length': 2.7061567164179103, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2344748', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1071, 'n_words': 428}