<commit_before>import React from 'react';
import PlacesAutocomplete, {
    geocodeByAddress,
    getLatLng,
} from 'react-places-autocomplete';
import { TextField } from "@material-ui/core"

export default class LocationAutocompleteInput extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            place: '',
            bounds: new window.google.maps.LatLngBounds()
        };
    }

    componentDidMount() {
        this.state.bounds.extend(new window.google.maps.LatLng(-90, -180))
        this.state.bounds.extend(new window.google.maps.LatLng(90, 180))
    }

    handleChange = place => {
        this.setState({ place });
    };

    handleSelect = place => {
        console.log(place)
        geocodeByAddress(place)
            .then(results => getLatLng(results[0]))
            .then(latLng => console.log('Success', {address: place, coordinates: latLng}))
            .catch(error => console.error('Error', error));
    };

    renderSuggestions({ getInputProps, suggestions, getSuggestionItemProps, loading }) {
        return (
            <div>
                <TextField
                    {...getInputProps({
                        placeholder: 'Ex. London Bridge',
                        className: 'location-search-input',
                    })}
                />
                <div className="autocomplete-dropdown-container">
                    {loading && <div>Loading...</div>}
                    {suggestions.map(suggestion => {
                        // highlights suggestion if being hovered over
                        const style = suggestion.active
                            ? { backgroundColor: '#fafafa', cursor: 'pointer' }
                            : { backgroundColor: '#ffffff', cursor: 'pointer' };
                        return (
                            <div
                                {...getSuggestionItemProps(suggestion, {
                                    style,
                                })}
                            >
                                <span>{suggestion.description}</span>
                            </div>
                        );
                    })}
                </div>
            </div>
        )
    }

    render() {
        return (
            <PlacesAutocomplete
                value={this.state.place}
                onChange={this.handleChange}
                onSelect={this.handleSelect}
                searchOptions={{
                    bounds: this.state.bounds
                }}
            >
                {this.renderSuggestions}
            </PlacesAutocomplete>
        );
    }
}<commit_msg>Remove prints and add comments<commit_after>import React from 'react';
import PlacesAutocomplete, {
    geocodeByAddress,
    getLatLng,
} from 'react-places-autocomplete';
import { TextField } from "@material-ui/core"

export default class LocationAutocompleteInput extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            place: '',
            bounds: new window.google.maps.LatLngBounds()
        };
    }

    componentDidMount() {
        // Sets search bounds to worldwide
        this.state.bounds.extend(new window.google.maps.LatLng(-90, -180))
        this.state.bounds.extend(new window.google.maps.LatLng(90, 180))
    }

    handleChange = place => {
        this.setState({ place });
    };

    handleSelect = place => {
        // retrieves latitue and logitude from address selected
        geocodeByAddress(place)
            .then(results => getLatLng(results[0]))
            .then(latLng => console.log('Success', {address: place, coordinates: latLng}))
            .catch(error => console.error('Error', error));
    };

    renderSuggestions({ getInputProps, suggestions, getSuggestionItemProps, loading }) {
        return (
            <div>
                <TextField
                    {...getInputProps({
                        placeholder: 'Ex. London Bridge',
                        className: 'location-search-input',
                    })}
                />
                <div className="autocomplete-dropdown-container">
                    {loading && <div>Loading...</div>}
                    {suggestions.map(suggestion => {
                        // highlights suggestion if being hovered over
                        const style = suggestion.active
                            ? { backgroundColor: '#fafafa', cursor: 'pointer' }
                            : { backgroundColor: '#ffffff', cursor: 'pointer' };
                        return (
                            <div
                                {...getSuggestionItemProps(suggestion, {
                                    style,
                                })}
                            >
                                <span>{suggestion.description}</span>
                            </div>
                        );
                    })}
                </div>
            </div>
        )
    }

    render() {
        return (
            <PlacesAutocomplete
                value={this.state.place}
                onChange={this.handleChange}
                onSelect={this.handleSelect}
                searchOptions={{
                    bounds: this.state.bounds
                }}
            >
                {this.renderSuggestions}
            </PlacesAutocomplete>
        );
    }
}
{'fraction_non_alphanumeric': 0.10886726638516615, 'fraction_numerical': 0.004038920506700936, 'mean_word_length': 1.2410530645824764, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3519482', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1259, 'n_words': 233}