<commit_before>from PyPaste.models import BaseModel


class User(BaseModel):

    @classmethod
    def init_table(self):
        cur = self._cursor()
        cur.execute(
            """
            CREATE TABLE IF NOT EXISTS users
            (
                id serial PRIMARY KEY UNIQUE,
                username varchar(25) UNIQUE,
                password varchar(60),
                active boolean
            );
            """
        )
        self.conn.commit()
        cur.close()

    @classmethod
    def new(self):
        pass

    @classmethod
    def by_username(self, username):
        """
        Convenience method to grab a paste by username

        """
        pastes = self._by_param('username', username)
        return pastes

    @classmethod
    def password_match(self, username, password):
        """
        Checks if $password is the correct password for $username
        """
        return self._password_match(username, password, _type='user')<commit_msg>rewrite: Fix a couple of mistakes in models/users.py<commit_after>from PyPaste.models import BaseModel


class User(BaseModel):

    @classmethod
    def init_table(self):
        cur = self._cursor()
        cur.execute(
            """
            CREATE TABLE IF NOT EXISTS users
            (
                id serial PRIMARY KEY UNIQUE,
                username varchar(25) UNIQUE,
                password varchar(60),
                active boolean
            );
            """
        )
        self.conn.commit()
        cur.close()

    @classmethod
    def new(self):
        pass

    @classmethod
    def by_username(self, username):
        """
        Convenience method to grab a user by username

        """
        user = self._by_param('username', username, table='users')
        return user

    @classmethod
    def password_match(self, username, password):
        """
        Checks if $password is the correct password for $username
        """
        return self._password_match(username, password, _type='user')
{'fraction_non_alphanumeric': 0.08689248895434462, 'fraction_numerical': 0.0039273441335297005, 'mean_word_length': 1.6993377483443708, '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': '6114279', 'n_tokens_mistral': 550, 'n_tokens_neox': 513, 'n_words': 149}