Test whether the attribute needs to be re-created, returns false if we can re-use it as-is.
426039
function rebuildAttribute (attrib, data, itemSize) {
  if (attrib.itemSize !== itemSize) return true
  if (!attrib.array) return true
  var attribLength = attrib.array.length
  if (Array.isArray(data) && Array.isArray(data[0])) {
    // [ [ x, y, z ] ]
    return attribLength !== data.length * itemSize
  } else {
    // [ x, y, z ]
    return attribLength !== data.length
  }
  return false
}
551255
def update_or_create(self, attributes, values=None):
        
        instance = self.first_or_new(**attributes)

        instance.fill(values)

        instance.save()

        return instance
134526
def restore_attribute!(attr_name)
        attr_name = attr_name.to_s
        if attribute_changed?(attr_name)
          __send__("#{attr_name}=", attribute_was(attr_name))
          clear_attribute_change(attr_name)
        end
      end
292868
def reset_attribute!(name)
      value = attribute_was(name)
      if value
        @attributes[name] = value
        modifications.delete(name)
      end
    end
917852
public boolean shouldReuseElements() {

        boolean isFalseInConfig = Boolean.FALSE.toString().equalsIgnoreCase(StringUtils.trim(m_reuseElementsStr));
        return !isFalseInConfig;
    }
762281
function( attr, val ) {
				var orgVal = this.getAttribute( attr );
				if ( val !== orgVal ) {
					!this._.attrChanges && ( this._.attrChanges = {} );

					// Saved the original attribute val.
					if ( !( attr in this._.attrChanges ) )
						this._.attrChanges[ attr ] = orgVal;

					this.setAttribute( attr, val );
				}
			}
251195
public boolean requireFirstTime(Attribute attribute) {
        if (!attribute.isJavaBaseClass()) {
            return ImportsContext.getCurrentImportsHolder().add(attribute.getFullType());
        }
        return false;
    }
97802
def hasAttribute(self, attrName):
        '''
            
        '''
        attrName = attrName.lower()

        # Check if requested attribute is present on this node
        return bool(attrName in self._attributes)
511358
def has_attribute(self, attr):
        
        if not hasattr(self._subject, attr):
            raise self._error_factory(_format("Expected {} to have attribute {}", self._subject, attr))
        return ReferenceInspector(getattr(self._subject, attr))
1280601
def __verify_ready(self, creating=False):
        '''
        '''

        if len(self._value_ranges) == 0:
            self._logger.log(
                'crit',
                'Attribute value_ranges must have at least one value'
            )
            raise RuntimeWarning(
                'Attribute value_ranges must have at least one value'
            )
        if len(self._employers) == 0 and creating is False:
            self._logger.log('crit', 'Need to create employers')
            raise RuntimeWarning('Need to create employers')
906936
public function usesAttributesArray(): bool
    {
        if ($this->arrayName === null) {
            return false;
        }

        if ($this->attributes === null) {
            return false;
        }

        return true;
    }
573075
def is_attribute(method, name=None):
    
    if name is None:
        name = method.__name__
    method.is_attribute = True
    method.name = name
    return method
155192
public function isValid() : bool
   {

      if ( $this->_support->hasAttribute( $this->_requiredAttributeName ) )
      {
         return true;
      }

      return $this->_support->hasAttribute( $this->_altAttributeName );

   }
1197950
def is_required(self, name):
        """"""
        return self.schema_element(name).repetition_type == parquet_thrift.FieldRepetitionType.REQUIRED
755124
def check_is_not_created(method):
    
    def check(self, *args, **kwargs):
        if self.id is not None:
            raise AlreadyCreatedError('%s.id %s already exists.' %
                                     (self.__class__.__name__, self.id))
        return method(self, *args, **kwargs)
    return check
1276360
def create_or_find_by!(attributes, &block)
      transaction(requires_new: true) { create!(attributes, &block) }
    rescue ActiveRecord::RecordNotUnique
      find_by!(attributes)
    end
352979
def has_attr(cls, attr_name):
    """"""
    if attr_name in cls.attrs:
      return True

    if isinstance(cls.primary_key_name, str) and cls.primary_key_name == attr_name:
      return True

    if isinstance(cls.primary_key_name, tuple) and attr_name in cls.primary_key_name:
      return True

    if cls.timestamps is not None and attr_name in cls.timestamps:
      return True

    return False