<commit_before>import pwd
from tempfile import mkdtemp
from datetime import timedelta

from dockerspawner import DockerSpawner
from textwrap import dedent
from traitlets import (
    Integer,
    Unicode,
)
from tornado import gen

from escapism import escape

import git


class CustomDockerSpawner(DockerSpawner):
    def __init__(self, **kwargs):
        self.repo_url = kwargs['repo_url']
        self.repo_sha = kwargs.get('last_commit', '')
        super(CustomDockerSpawner, self).__init__(**kwargs)

    _git_executor = None
    @property
    def git_executor(self):
        """single global git executor"""
        cls = self.__class__
        if cls._git_executor is None:
            cls._git_executor = ThreadPoolExecutor(1)
        return cls._git_executor

    _git_client = None
    @property
    def git_client(self):
        """single global git client instance"""
        cls = self.__class__
        if cls._git_client is None:
            cls._git_client = git.Git()
        return cls._git_client

    def _git(self, method, *args, **kwargs):
        """wrapper for calling git methods
        
        to be passed to ThreadPoolExecutor
        """
        m = getattr(self.git_client, method)
        return m(*args, **kwargs)

    def git(self, method, *args, **kwargs):
        """Call a git method in a background thread
        
        returns a Future
        """
        return self.executor.submit(self._git, method, *args, **kwargs)

    def get_state(self):
        return {} #state = super(DockerSpawner, self).get_state()

    _escaped_repo_url = None
    @property
    def escaped_repo_url(self):
        if self._escaped_repo_url is None:<commit_msg>Use default get_state<commit_after>import pwd
from tempfile import mkdtemp
from datetime import timedelta

from dockerspawner import DockerSpawner
from textwrap import dedent
from traitlets import (
    Integer,
    Unicode,
)
from tornado import gen

from escapism import escape

import git


class CustomDockerSpawner(DockerSpawner):
    def __init__(self, **kwargs):
        self.repo_url = kwargs['repo_url']
        self.repo_sha = kwargs.get('last_commit', '')
        super(CustomDockerSpawner, self).__init__(**kwargs)

    _git_executor = None
    @property
    def git_executor(self):
        """single global git executor"""
        cls = self.__class__
        if cls._git_executor is None:
            cls._git_executor = ThreadPoolExecutor(1)
        return cls._git_executor

    _git_client = None
    @property
    def git_client(self):
        """single global git client instance"""
        cls = self.__class__
        if cls._git_client is None:
            cls._git_client = git.Git()
        return cls._git_client

    def _git(self, method, *args, **kwargs):
        """wrapper for calling git methods
        
        to be passed to ThreadPoolExecutor
        """
        m = getattr(self.git_client, method)
        return m(*args, **kwargs)

    def git(self, method, *args, **kwargs):
        """Call a git method in a background thread
        
        returns a Future
        """
        return self.executor.submit(self._git, method, *args, **kwargs)

    _escaped_repo_url = None

    @property
    def escaped_repo_url(self):
        if self._escaped_repo_url is None:
{'fraction_non_alphanumeric': 0.08903068975995138, 'fraction_numerical': 0.0006077180188392585, 'mean_word_length': 2.6175824175824176, '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': '4536880', 'n_tokens_mistral': 983, 'n_tokens_neox': 977, 'n_words': 275}