<commit_before>class CaretakerFormObject extends React.Component{
	constructor(props){
		super(props)
		this.state = {}
		if(this.isMany()){
			this.state.value = []
			this.state.name = "arr"
		}
		else if(this.isObject()){
			this.state.value = {}
			this.state.name = "obj"
		}else{
			this.state.value = null
			this.state.name = "val"
		}
		this.loadValue(props)
	}
	componentDidMount(){
		this.updateParent()
	}
	componentWillReceiveProps(props){
		this.loadValue(props)
		this.setState(this.state)
	}
	assertValues(){
		if(this.isMany() && !(Array.isArray(this.state.value) || this.state.value == null)){
			throw "Value for manyObjects must be an array"
		}else if(this.isObject() && !(typeof this.state.value == "object" || this.state.value == null)){
			throw "Value for Object must be an object"
		}
	}
	loadValue(props){

		if(props.value != null){
			this.state.value = props.value
		}else if(props.defaultValue != null){
			this.state.value = props.defaultValue
		}

		if(props.name != null){
			this.state.name = props.name
		}
		this.assertValues()
	}
	isMany(){
		return this.props.quantity == "many"
	}
	isObject(){
		return this.props.type == "object"
	}
	isInput(){
		return !this.isObject() && !this.isMany()
	}
	updateParent(){
		if(this.props.onChange){
			this.props.onChange(this.state.value, this.state.name)
		}
		this.setState(this.state)
	}
	onChange(value, name){
		if(name != null){
			this.state.value[name] = value
		}else{
			this.state.value = value
		}
		this.updateParent()
	}
	getOnChangeListener(){
		return this.onChange.bind(this)
	}
	getNegativeChildPropKeys(){
		return ["label","description","quantity"]
	}
	getNegativeInputPropKeys(){
		return ["label","description","quantity","has","defaultValue"]
	}
	getInputProps(){
		var props = Object.assign({}, this.props)
		this.getNegativeInputPropKeys().forEach(function(key){
			props[key] = null
			delete props[key]
		})
		props.onChange = this.getOnChangeListener()
		props.value = this.state.value
		return props
	}
	getCollectionProps(){
		var props = Object.assign({}, this.props)
		this.getNegativeChildPropKeys().forEach(function(key){
			props[key] = null
			delete props[key]
		})
		props.onChange = this.getOnChangeListener()
		props.value = this.state.value
		return props
	}
	appearanceGetLabel(){
		if(this.props.label){
			if(this.isObject()){
				return React.createElement('h5', {className:"CaretakerObjectLabel", key:"label"}, this.props.label)
			}else{
				return React.createElement('label', {className:"CaretakerLabel", htmlFor: this.state.name, key:"label"}, this.props.label)
			}
		}
		return false
	}
	appearanceGetDescription(){
		if(this.props.description){
			return React.createElement('p', {key:"description"}, (
				React.createElement('small',{},this.props.description)
			))
		}
		return false;
	}
	appearanceGetObject(){
		if(this.isMany()){
			var props = this.getCollectionProps()
			props.key = "object"<commit_msg>fixed form resettable<commit_after>class CaretakerFormObject extends React.Component{
	constructor(props){
		super(props)
		this.state = {}
		this.loadValue(props)
	}
	componentDidMount(){
		this.updateParent()
	}
	componentWillReceiveProps(props){
		this.loadValue(props)
		this.setState(this.state)
	}
	assertValues(){
		if(this.isMany() && !(Array.isArray(this.state.value) || this.state.value == null)){
			throw "Value for manyObjects must be an array"
		}else if(this.isObject() && !(typeof this.state.value == "object" || this.state.value == null)){
			throw "Value for Object must be an object"
		}
	}
	loadValue(props){

		if(this.isMany()){
			this.state.value = []
			this.state.name = "arr"
		}
		else if(this.isObject()){
			this.state.value = {}
			this.state.name = "obj"
		}else{
			this.state.value = null
			this.state.name = "val"
		}

		if(props.value != null){
			this.state.value = props.value
		}else if(props.defaultValue != null){
			this.state.value = props.defaultValue
		}

		if(props.name != null){
			this.state.name = props.name
		}
		this.assertValues()
	}
	isMany(){
		return this.props.quantity == "many"
	}
	isObject(){
		return this.props.type == "object" || this.props.type == null
	}
	isInput(){
		return !this.isObject() && !this.isMany()
	}
	updateParent(){
		if(this.props.onChange){
			this.props.onChange(this.state.value, this.state.name)
		}
		this.setState(this.state)
	}
	onChange(value, name){
		if(name != null){
			this.state.value[name] = value
		}else{
			this.state.value = value
		}
		this.updateParent()
	}
	getOnChangeListener(){
		return this.onChange.bind(this)
	}
	getNegativeChildPropKeys(){
		return ["label","description","quantity"]
	}
	getNegativeInputPropKeys(){
		return ["label","description","quantity","has","defaultValue"]
	}
	getInputProps(){
		var props = Object.assign({}, this.props)
		this.getNegativeInputPropKeys().forEach(function(key){
			props[key] = null
			delete props[key]
		})
		props.onChange = this.getOnChangeListener()
		props.value = this.state.value
		return props
	}
	getCollectionProps(){
		var props = Object.assign({}, this.props)
		this.getNegativeChildPropKeys().forEach(function(key){
			props[key] = null
			delete props[key]
		})
		props.onChange = this.getOnChangeListener()
		props.value = this.state.value
		return props
	}
	appearanceGetLabel(){
		return React.createElement('label', {className:"CaretakerLabel", htmlFor: this.state.name, key:"label"}, this.props.label)
	}
	appearanceGetDescription(){
		if(this.props.description){
			return React.createElement('p', {className:"CaretakerDescription",key:"description"}, (
				this.props.description
			))
		}
		return false;
	}
	appearanceGetObject(){
		if(this.isMany()){
			var props = this.getCollectionProps()
			props.key = "object"
{'fraction_non_alphanumeric': 0.1624542443785951, 'fraction_numerical': 0.0001743071291615827, 'mean_word_length': 4.132379248658318, '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': '2264903', 'n_tokens_mistral': 2174, 'n_tokens_neox': 1955, 'n_words': 335}