Function for token attributes extension, methods extension
        Use set_extension method.
        Reference: https://spacy.io/api/token, https://spacy.io/usage/processing-pipelines#custom-components-attributes
170129
def custom_token(spacy_token) -> Token:
        

        """Add custom attributesAdd full_shape attribute. Eg. 21.33 => dd.dd, esadDeweD23 => xxxxXxxxXdd"""

        def get_shape(token):
            full_shape = ""
            for i in token.text:
                if i.isdigit():
                    full_shape += "d"
                elif i.islower():
                    full_shape += "x"
                elif i.isupper():
                    full_shape += "X"
                else:
                    full_shape += i
            return full_shape

        spacy_token.set_extension("full_shape", getter=get_shape, force=True)

        def is_integer(token):
            pattern = re.compile('^[-+]?[0-9]+$')
            return bool(pattern.match(token.text))

        spacy_token.set_extension("is_integer", getter=is_integer, force=True)

        def is_decimal(token):
            pattern = re.compile('^[-+]?[0-9]+\.[0-9]+$')
            return bool(pattern.match(token.text))

        spacy_token.set_extension("is_decimal", getter=is_decimal, force=True)

        def is_ordinal(token):
            return token.orth_[-2:] in ['rd', 'st', 'th', 'nd']

        spacy_token.set_extension("is_ordinal", getter=is_ordinal, force=True)

        def is_mixed(token):
            if not token.is_title and not token.is_lower and not token.is_upper:
                return True
            else:
                return False

        spacy_token.set_extension("is_mixed", getter=is_mixed, force=True)

        """Add custom methodsAdd get_prefix method. RETURN length N prefix"""

        def n_prefix(token, n):
            return token.text[:n]

        spacy_token.set_extension("n_prefix", method=n_prefix, force=True)

        """Add get_suffix method. RETURN length N suffix"""

        def n_suffix(token, n):
            return token.text[-n:]

        spacy_token.set_extension("n_suffix", method=n_suffix, force=True)

        return spacy_token
1281816
def _handle_attribute(self, start):
        """"""
        name = quotes = None
        self._push()
        while self._tokens:
            token = self._tokens.pop()
            if isinstance(token, tokens.TagAttrEquals):
                name = self._pop()
                self._push()
            elif isinstance(token, tokens.TagAttrQuote):
                quotes = token.char
            elif isinstance(token, (tokens.TagAttrStart, tokens.TagCloseOpen,
                                    tokens.TagCloseSelfclose)):
                self._tokens.append(token)
                if name:
                    value = self._pop()
                else:
                    name, value = self._pop(), None
                return Attribute(name, value, quotes, start.pad_first,
                                 start.pad_before_eq, start.pad_after_eq)
            else:
                self._write(self._handle_token(token))
        raise ParserError("_handle_attribute() missed a close token")
673606
def exchange_typecasting_alias_method_chain attribute, setter=nil
      alias_method :"#{attribute}_without_exchange_typecasting#{setter}", :"#{attribute}#{setter}"
      alias_method :"#{attribute}#{setter}", :"#{attribute}_with_exchange_typecasting#{setter}"
    end
963290
function buildJSXOpeningElementAttributes(attribs, file) {
    var _props = [];
    var objs = [];

    var pushProps = function pushProps() {
      if (!_props.length) return;

      objs.push(t.objectExpression(_props));
      _props = [];
    };

    while (attribs.length) {
      var prop = attribs.shift();
      if (t.isJSXSpreadAttribute(prop)) {
        pushProps();
        objs.push(prop.argument);
      } else {
        _props.push(prop);
      }
    }

    pushProps();

    if (objs.length === 1) {
      // only one object
      attribs = objs[0];
    } else {
      // looks like we have multiple objects
      if (!t.isObjectExpression(objs[0])) {
        objs.unshift(t.objectExpression([]));
      }

      // spread it
      attribs = t.callExpression(file.addHelper("extends"), objs);
    }

    return attribs;
  }
6744
def custom_object_extension_prefix_strict(instance):
    
    for key, obj in instance['objects'].items():
        if not ('extensions' in obj and 'type' in obj and
                obj['type'] in enums.OBSERVABLE_EXTENSIONS):
            continue
        for ext_key in obj['extensions']:
            if (ext_key not in enums.OBSERVABLE_EXTENSIONS[obj['type']] and
                    not CUSTOM_TYPE_PREFIX_RE.match(ext_key)):
                yield JSONError("Custom Cyber Observable Object extension type"
                                " '%s' should start with 'x-' followed by a source "
                                "unique identifier (like a domain name with dots "
                                "replaced by hyphens), a hyphen and then the name."
                                % ext_key, instance['id'],
                                'custom-prefix')
392899
def method_missing mtd, *args
      if mtd.to_s.chars.to_a.last == '='
        raise ArgumentError, "Invalid number of arguments (#{args.length} for 1)" if args.length != 1
        attributes[mtd.to_s.slice(0,mtd.to_s.length-1)] = args.first
      else
        raise ArgumentError, "Invalid number of arguments (#{args.length} for 0)" if args.length != 0
        attributes[mtd.to_s]
      end
    end
1096042
def method_missing(name, *args)
      name = name.to_s
      last_char = name[-1,1]
      super(name, *args) unless last_char == "=" || last_char == "?"
      attr_name = name[0..-2].to_sym # :foo for 'foo=' or 'foo?'
      if last_char == "="
        @options[attr_name] = args.at(0)
      else
        @options[attr_name]
      end
    end
192813
function(options) {
      var attrs = {};
      for (var key in this.attributes) attrs[key] = void 0;
      return this.set(attrs, _.extend({}, options, {unset: true}));
    }
567562
function parseMethodsFromRust (source) {
  // Matching the custom `rpc` attribute with it's doc comment
  const attributePattern = /((?:\s*\/\/\/.*$)*)\s*#\[rpc\(([^)]+)\)]/gm;
  const commentPattern = /\s*\/\/\/\s*/g;
  const separatorPattern = /\s*,\s*/g;
  const assignPattern = /([\S]+)\s*=\s*"([^"]*)"/;
  const ignorePattern = /@(ignore|deprecated|unimplemented|alias)\b/i;

  const methods = [];

  source.toString().replace(attributePattern, (match, comment, props) => {
    comment = comment.replace(commentPattern, '\n').trim();

    // Skip deprecated methods
    if (ignorePattern.test(comment)) {
      return match;
    }

    props.split(separatorPattern).forEach((prop) => {
      const [, key, value] = prop.split(assignPattern) || [];

      if (key === 'name' && value != null) {
        methods.push(value);
      }
    });

    return match;
  });

  return methods;
}
793296
def method_missing(meth, *args)
      m = meth.id2name
      if m =~ /=$/
        @attributes[m.chop.to_sym] = (args.length < 2 ? args[0] : args)
      else
        @attributes[m.to_sym]
      end
    end
48327
def _set_attribute_as_deprecated(attribute)
      original_attribute_method = instance_method(attribute.to_sym)

      klass = self
      define_method attribute.to_sym do |*args|
        backtrace_cleaner = ActiveSupport::BacktraceCleaner.new

        backtrace = backtrace_cleaner.clean(caller)

        klass._notify_deprecated_attribute_call({klass: self, attribute: attribute, args: args, backtrace: backtrace})

        # Call the original attribute method.
        original_attribute_method.bind(self).call(*args)
      end
    end
429398
function(expAst, attribute) {
        //verify that an event handler is a function call
        if (expAst && isEventHandlerAttr(attribute.name) && expAst.v !== '(') {
            this._logError("Event handler attribute only support function expressions", attribute.value[0]);
        }
    }
55680
def populate_token_attributes(self, response):
        """"""

        if 'access_token' in response:
            self.access_token = response.get('access_token')

        if 'refresh_token' in response:
            self.refresh_token = response.get('refresh_token')

        if 'token_type' in response:
            self.token_type = response.get('token_type')

        if 'expires_in' in response:
            self.expires_in = response.get('expires_in')
            self._expires_at = time.time() + int(self.expires_in)

        if 'expires_at' in response:
            self._expires_at = int(response.get('expires_at'))

        if 'mac_key' in response:
            self.mac_key = response.get('mac_key')

        if 'mac_algorithm' in response:
            self.mac_algorithm = response.get('mac_algorithm')
1361623
def extend(self, **attributes):
        
        for key, value in attributes.iteritems():
            if not hasattr(self, key):
                setattr(self, key, value)
538600
def method_missing(name, *args)  # :nodoc:
    # -- original perl comment --
    # There are two types of set methods: set_property() and
    # set_property_color(). When a method is AUTOLOADED we store a new anonymous
    # sub in the appropriate slot in the symbol table. The speeds up subsequent
    # calls to the same method.

    method = "#{name}"

    # Check for a valid method names, i.e. "set_xxx_yyy".
    method =~ /set_(\w+)/ or raise "Unknown method: #{method}\n"

    # Match the attribute, i.e. "@xxx_yyy".
    attribute = "@#{$1}"

    # Check that the attribute exists
    # ........
    if method =~ /set\w+color$/    # for "set_property_color" methods
      value = get_color(args[0])
    else                            # for "set_xxx" methods
      value = args[0].nil? ? 1 : args[0]
    end
    if value.respond_to?(:to_str) || !value.respond_to?(:+)
      s = %Q!#{attribute} = "#{value.to_s}"!
    else
      s = %Q!#{attribute} =   #{value.to_s}!
    end
    eval s
  end
283308
def setattr(self, key, value):
		
		if key in _MethodFactoryMeta[self.classId]:
			self.__dict__[key] = value
		elif key == 'errorCode':
			self.errorCode = value
		elif key == 'errorDescr':
			self.errorDescr = value
		elif key == 'invocationResult':
			self.invocationResult = value
		elif key == 'response':
			self.response = value
		else:
			""" no such property """
			# print "No such property ClassId: %s Property:%s" %(self.classId, key)
			return None
91203
def buffer_attributes(attributes, extension)
      # Proc for setting class attribute extension, used as DRY closure
      #
      buffer_class_attribute_type_check = proc do |variable, escape = true|
        class_variable = buffer_set_variable :local, variable

        # Check if we need to add the class attribute
        buffer_eval "unless #{class_variable} and true === #{class_variable}"

        # Check if class attribute has array value
        buffer_eval "if Array === #{class_variable}"
        ruby_code = "#{class_variable}.join ' '"
        if escape
          buffer_escape ruby_code
        else
          buffer ruby_code
        end

        # Check if class attribute has hash value
        buffer_eval "elsif Hash === #{class_variable}"
        ruby_code = "#{class_variable}.to_a.join ' '"
        if escape
          buffer_escape ruby_code
        else
          buffer ruby_code
        end

        # Other values
        buffer_eval 'else'
        ruby_code = "#{class_variable}"
        if escape
          buffer_escape ruby_code
        else
          buffer ruby_code
        end

        # End cases
        buffer_eval 'end'

        # End
        buffer_eval 'end'
      end

      # Handle class attributes by checking if they're simple, noninterpolated
      # strings or not and extend them if needed
      #
      buffer_class_attribute = proc do |attribute|
        if attribute[@value] =~ Tokens[:exp_string_match]
          buffer_split_by_interpolation attribute[@value][1..-2],
                                        attribute[@options][:escaped]
        else
          buffer_class_attribute_type_check[
            attribute[@value],
            attribute[@options][:escaped]
          ]
        end
      end

      # If we have class attributes, process each one and check if we have an
      # extension for them
      if attributes[:class]
        buffer_freeze " class=\""

        # Process every class attribute
        attributes[:class].each do |node_class|
          buffer_class_attribute[node_class]
          buffer_freeze ' '
        end

        # Remove trailing whitespace from the buffer
        buffer_remove_last_character

        # Check for extension with :class key
        if extension
          buffer_eval "if #{extension[:name]}.has_key? :class"
          buffer_freeze ' '
          buffer_class_attribute_type_check[
            "#{extension[:name]}.delete(:class)"
          ]
          buffer_eval 'end'
        end

        buffer_freeze '"'
      elsif extension
        # If we do not have class attributes but we do have an extension, try to
        # see if the extension contains a class attribute
        buffer_eval "if #{extension[:name]}.has_key? :class"
        buffer_freeze " class=\""
        buffer_class_attribute_type_check["#{extension[:name]}.delete(:class)"]
        buffer_freeze '"'
        buffer_eval 'end'
      end

      # Proc for setting class attribute extension, used as DRY closure
      #
      buffer_data_attribute_type_check = proc do |key, variable, escape = true, dynamic = false|
        # Check if variable is set
        buffer_eval "if #{variable}"

        # @Array
        buffer_eval "if Array === #{variable}"
        dynamic ? buffer("\" #{key}=\\\"\"") : buffer_freeze(" #{key}=\"")

        ruby_code = "#{variable}.join '_'"
        if escape
          buffer_escape ruby_code
        else
          buffer ruby_code
        end

        buffer_freeze '"'

        # @Hash
        buffer_eval "elsif Hash === #{variable}"
        buffer_eval "#{variable}.each do |#{OPULENT_KEY}, #{OPULENT_VALUE}|"
        # key-hashkey
        dynamic ? buffer("\" #{key}-\"") : buffer_freeze(" #{key}-")
        buffer "#{OPULENT_KEY}.to_s"
        #="value"
        buffer_freeze "=\""
        escape ? buffer_escape(OPULENT_VALUE) : buffer(OPULENT_VALUE)
        buffer_freeze '"'
        buffer_eval 'end'

        # @TrueClass
        buffer_eval "elsif true === #{variable}"
        dynamic ? buffer("\" #{key}\"") : buffer_freeze(" #{key}")

        # @Object
        buffer_eval 'else'
        dynamic ? buffer("\" #{key}=\\\"\"") : buffer_freeze(" #{key}=\"")
        escape ? buffer_escape("#{variable}") : buffer("#{variable}")
        buffer_freeze '"'

        # End Cases
        buffer_eval 'end'

        # End
        buffer_eval 'end'
      end

      # Handle data (normal) attributes by checking if they're simple, noninterpolated
      # strings and extend them if needed
      #
      buffer_data_attribute = proc do |key, attribute|
        # When we have an extension for our attributes, check current key.
        # If it exists, check it's type and generate everything dynamically
        if extension
          buffer_eval "if #{extension[:name]}.has_key? :\"#{key}\""
          variable = buffer_set_variable :local,
                                         "#{extension[:name]}" \
                                         ".delete(:\"#{key}\")"
          buffer_data_attribute_type_check[
            key,
            variable,
            attribute[@options][:escaped]
          ]
          buffer_eval 'else'
        end

        # Check if the set attribute is a simple string. If it is, freeze it or
        # escape it. Otherwise, evaluate and initialize the type check.
        if attribute[@value] =~ Tokens[:exp_string_match]
          buffer_freeze " #{key}=\""
          buffer_split_by_interpolation attribute[@value][1..-2],
                                        attribute[@options][:escaped]
          buffer_freeze "\""
        else
          # Evaluate and type check
          variable = buffer_set_variable :local, attribute[@value]
          buffer_data_attribute_type_check[
            key,
            variable,
            attribute[@options][:escaped]
          ]
        end

        # Extension end
        buffer_eval 'end' if extension
      end

      # Process the remaining, non-class related attributes
      attributes.each do |key, attribute|
        next if key == :class
        buffer_data_attribute[key, attribute]
      end

      # Process remaining extension keys if there are any
      return unless extension

      buffer_eval "#{extension[:name]}.each do " \
                  "|ext#{OPULENT_KEY}, ext#{OPULENT_VALUE}|"

      buffer_data_attribute_type_check[
        "\#{ext#{OPULENT_KEY}}",
        "ext#{OPULENT_VALUE}",
        extension[:escaped],
        true
      ]
      buffer_eval 'end'
    end