<commit_before>import json
import datetime

def current_dt() -> str:
    """Current UTC date and time as 'yyyy-mm-dd hh:mm:ss'."""
    return datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')

def parse_dt(dt: str) -> datetime.datetime:
    """Parse 'yyyy-mm-dd hh:mm:ss' to datetime."""
    return datetime.datetime.strptime(dt, '%Y-%m-%d %H:%M:%S')


class Vault:
    def __init__(self) -> None:
        """Create empty vault."""
        self.entries = {}

    def list(self):
        """List vault contents."""
        return sorted(self.entries.keys())

    def set(self, credname: str, **data) -> None:
        """Set vault entry."""
        # keeps old created if overwriting existing entry
        now = current_dt()
        data['created'] = self.entries.get(credname, {}).get('created', now) 
        data['modified'] = now
        self.entries[credname] = data

    def get(self, credname: str):
        """Get vault entry."""
        return self.entries[credname]

    def search(self, credsubstr: str):
        """Case-insensitive substring search of vault."""
        css_low = credsubstr.lower()
        return sorted([(k,v) for k, v in self.entries.items() if css_low in k.lower()])

    def remove(self, credname: str) -> None:
        """Remove vault entry."""
        del self.entries[credname]

    def dumps(self) -> str:
        """Serialize vault using JSON."""
        return json.dumps(self.entries)

    def loads(self, s: str) -> None:
        """Deserialize vault from JSON."""
        self.entries = json.loads(s)<commit_msg>Change so search() that git commits smashed somehow.<commit_after>import json
import datetime

def current_dt() -> str:
    """Current UTC date and time as 'yyyy-mm-dd hh:mm:ss'."""
    return datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')

def parse_dt(dt: str) -> datetime.datetime:
    """Parse 'yyyy-mm-dd hh:mm:ss' to datetime."""
    return datetime.datetime.strptime(dt, '%Y-%m-%d %H:%M:%S')


class Vault:
    def __init__(self) -> None:
        """Create empty vault."""
        self.entries = {}

    def list(self):
        """List vault contents."""
        return sorted(self.entries.keys())

    def set(self, credname: str, **data) -> None:
        """Set vault entry."""
        # keeps old created if overwriting existing entry
        now = current_dt()
        data['created'] = self.entries.get(credname, {}).get('created', now) 
        data['modified'] = now
        self.entries[credname] = data

    def get(self, credname: str):
        """Get vault entry."""
        return self.entries[credname]

    def search(self, credsubstr: str):
        """Case-insensitive substring search of vault."""
        css_low = credsubstr.lower()
        return sorted([k for k in self.entries if css_low in k.lower()])

    def remove(self, credname: str) -> None:
        """Remove vault entry."""
        del self.entries[credname]

    def dumps(self) -> str:
        """Serialize vault using JSON."""
        return json.dumps(self.entries)

    def loads(self, s: str) -> None:
        """Deserialize vault from JSON."""
        self.entries = json.loads(s)
{'fraction_non_alphanumeric': 0.16221374045801526, 'fraction_numerical': 0.0, 'mean_word_length': 2.661233993015134, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '1704871', 'n_tokens_mistral': 970, 'n_tokens_neox': 946, 'n_words': 273}