<commit_before>import numpy as np


class Box(object):
    """A box representing the bounds of the system.

    Attributes
    ----------
    mins : np.ndarray, shape=(3,), dtype=float
        Minimum x, y, z coordinates.
    maxs : np.ndarray, shape=(3,), dtype=float
        Maximum x, y, z coordinates.
    lengths : np.ndarray, shape(3,), dtype=float
        Box length in x, y and z directions.

    """
    def __init__(self, lengths=None, mins=None, maxs=None):
        if lengths is not None:
            assert mins is None and maxs is None
            self._mins = np.array([0.0, 0.0, 0.0])
            self._maxs = np.array(lengths)
            self._lengths = np.array(lengths)
        elif maxs is not None:
            assert mins is not None and lengths is None
            self._mins = np.array(mins)
            self._maxs = np.array(maxs)
            self._lengths = self.maxs - self.mins
        else:
            raise ValueError("Either provide `lengths` or `mins` and `maxs`."
                             "You provided: lengths={} mins={} maxs={}".format(lengths, mins, maxs))

    @property
    def mins(self):
        return self._mins

    @property
    def maxs(self):
        return self._maxs

    @property
    def lengths(self):
        return self._lengths

    @mins.setter
    def mins(self, mins):
        assert mins.shape == (3, )
        self._mins = mins
        self._lengths = self.maxs - self.mins

    @maxs.setter
    def maxs(self, maxes):
        assert maxes.shape == (3, )
        self._maxs = maxes
        self._lengths = self.maxs - self.mins

    @lengths.setter
    def lengths(self, lengths):
        assert lengths.shape == (3, )
        self._maxs += 0.5*lengths - 0.5*self.lengths
        self._mins -= 0.5*lengths - 0.5*self.lengths
        self._lengths = lengths

    def scale(self, scale_factors):
        """Scale one or more dimensions of the box

        Takes an array of length three as input and scales the box
        lengths in x, y , and z by these values.

        Parameters
        ----------
        scale_factors : list of floats, length=3
            Factors to scale the x, y, and z dimensions of the box by

        """
        
        self.lengths *= scale_factor

    def center(self):
        """Center the box about the origin. """

        self._mins = [-d/2 for d in self.lengths]
        self._maxs = [d/2 for d in self.lengths]

    def __repr__(self):
        return "Box(mins={}, maxs={})".format(self.mins, self.maxs)<commit_msg>Fixed bug in scale()<commit_after>import numpy as np


class Box(object):
    """A box representing the bounds of the system.

    Attributes
    ----------
    mins : np.ndarray, shape=(3,), dtype=float
        Minimum x, y, z coordinates.
    maxs : np.ndarray, shape=(3,), dtype=float
        Maximum x, y, z coordinates.
    lengths : np.ndarray, shape(3,), dtype=float
        Box length in x, y and z directions.

    """
    def __init__(self, lengths=None, mins=None, maxs=None):
        if lengths is not None:
            assert mins is None and maxs is None
            self._mins = np.array([0.0, 0.0, 0.0])
            self._maxs = np.array(lengths)
            self._lengths = np.array(lengths)
        elif maxs is not None:
            assert mins is not None and lengths is None
            self._mins = np.array(mins)
            self._maxs = np.array(maxs)
            self._lengths = self.maxs - self.mins
        else:
            raise ValueError("Either provide `lengths` or `mins` and `maxs`."
                             "You provided: lengths={} mins={} maxs={}".format(lengths, mins, maxs))

    @property
    def mins(self):
        return self._mins

    @property
    def maxs(self):
        return self._maxs

    @property
    def lengths(self):
        return self._lengths

    @mins.setter
    def mins(self, mins):
        assert mins.shape == (3, )
        self._mins = mins
        self._lengths = self.maxs - self.mins

    @maxs.setter
    def maxs(self, maxes):
        assert maxes.shape == (3, )
        self._maxs = maxes
        self._lengths = self.maxs - self.mins

    @lengths.setter
    def lengths(self, lengths):
        assert lengths.shape == (3, )
        self._maxs += 0.5*lengths - 0.5*self.lengths
        self._mins -= 0.5*lengths - 0.5*self.lengths
        self._lengths = lengths

    def scale(self, scale_factors):
        """Scale one or more dimensions of the box

        Takes an array of length three as input and scales the box
        lengths in x, y , and z by these values.

        Parameters
        ----------
        scale_factors : list of floats, length=3
            Factors to scale the x, y, and z dimensions of the box by

        """
        
        self.lengths *= scale_factors

    def center(self):
        """Center the box about the origin. """

        self._mins = [-d/2 for d in self.lengths]
        self._maxs = [d/2 for d in self.lengths]

    def __repr__(self):
        return "Box(mins={}, maxs={})".format(self.mins, self.maxs)
{'fraction_non_alphanumeric': 0.11648177496038035, 'fraction_numerical': 0.009112519809825673, 'mean_word_length': 1.8557692307692308, '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': '3338827', 'n_tokens_mistral': 1630, 'n_tokens_neox': 1553, 'n_words': 484}