<commit_before>require 'wsdl/importer'

module WSDL
  class Definitions

    def find_by_action action, output = false
      #FIXME find from all
      #ищем операцию и  описывающий ещё wsdl:message
      op = self.porttypes.first.operations.find{ |o| o.name == action }
      mes = ( output ? op.output : op.input).message
      # что то делаем... РАЗОБРАТЬ
      ps = self.bindings.first.operations.find{ |o| o.name == action }.input.soapbody.parts
      #находим части messag
      self.collect_elements.find_name self.message( mes ).parts.find{|p| ps.present? ? p.name == ps : true }.element.name
    end

    def soap_actions
      self.porttypes.map { |pt| pt.operations.map(&:name) }.flatten.uniq
    end

  end

  module XMLSchema

    class Element

      attr_accessor :value

      def children
        self.complex_type ? self.complex_type.nested_elements : XSD::NamedElements::Empty
      end
      
      def complex_type
        @complex_type ||= self.type ? self.root.collect_complextypes.find_name(self.type.name) : self.local_complextype
      end<commit_msg>raised on incorrect action for wsdl<commit_after>require 'wsdl/importer'

module WSDL
  class Definitions

    def find_by_action action, output = false
      #FIXME find from all
      #ищем операцию и  описывающий ещё wsdl:message
      raise Error.new("operation '#{action}' not found") unless op = self.porttypes.first.operations.find{ |o| o.name == action }

      mes = ( output ? op.output : op.input).message
      # что то делаем... РАЗОБРАТЬ
      ps = self.bindings.first.operations.find{ |o| o.name == action }.input.soapbody.parts
      #находим части messag
      self.collect_elements.find_name self.message( mes ).parts.find{|p| ps.present? ? p.name == ps : true }.element.name
    end

    def soap_actions
      self.porttypes.map { |pt| pt.operations.map(&:name) }.flatten.uniq
    end

  end

  module XMLSchema

    class Element

      attr_accessor :value

      def children
        self.complex_type ? self.complex_type.nested_elements : XSD::NamedElements::Empty
      end
      
      def complex_type
        @complex_type ||= self.type ? self.root.collect_complextypes.find_name(self.type.name) : self.local_complextype
      end
{'fraction_non_alphanumeric': 0.1029082774049217, 'fraction_numerical': 0.0, 'mean_word_length': 2.8156996587030716, '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': '2433288', 'n_tokens_mistral': 748, 'n_tokens_neox': 734, 'n_words': 170}