<commit_before>import os
import numpy as np
from .. import register_survey, with_metaclass

# metaclass for registration.
# see https://effectivepython.com/2015/02/02/register-class-existence-with-metaclasses/
class Meta(type):
    def __new__(meta, name, bases, class_dict):
        cls = type.__new__(meta, name, bases, class_dict)
        register_survey(cls)
        return cls

class BaseSurvey(object):
    @staticmethod
    def getConfigfile():
        pass

    @staticmethod
    def getFootprint():
        pass

class Survey(with_metaclass(Meta, BaseSurvey)):
    pass

class DES(Survey):
    def getConfigfile():
        this_dir, this_filename = os.path.split(__file__)
        return os.path.join(this_dir, "des.pkl")

    def getFootprint():
        """Returns RA, Dec of the survey footprint."""
        this_dir, this_filename = os.path.split(__file__)
        datafile = os.path.join(this_dir, "des-round17-poly.txt")
        data = np.loadtxt(datafile)
        return data[:,0], data[:,1]
<commit_msg>added @staticmethod for python2; needed for #23<commit_after>import os
import numpy as np
from .. import register_survey, with_metaclass

# metaclass for registration.
# see https://effectivepython.com/2015/02/02/register-class-existence-with-metaclasses/
class Meta(type):
    def __new__(meta, name, bases, class_dict):
        cls = type.__new__(meta, name, bases, class_dict)
        register_survey(cls)
        return cls

class BaseSurvey(object):
    @staticmethod
    def getConfigfile():
        pass

    @staticmethod
    def getFootprint():
        pass

class Survey(with_metaclass(Meta, BaseSurvey)):
    pass

class DES(Survey):
    @staticmethod
    def getConfigfile():
        this_dir, this_filename = os.path.split(__file__)
        return os.path.join(this_dir, "des.pkl")

    @staticmethod
    def getFootprint():
        """Returns RA, Dec of the survey footprint."""
        this_dir, this_filename = os.path.split(__file__)
        datafile = os.path.join(this_dir, "des-round17-poly.txt")
        data = np.loadtxt(datafile)
        return data[:,0], data[:,1]

{'fraction_non_alphanumeric': 0.11432637571157495, 'fraction_numerical': 0.012808349146110056, 'mean_word_length': 3.143418467583497, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2461790', 'n_tokens_mistral': 679, 'n_tokens_neox': 659, 'n_words': 156}