<commit_before># -*- coding: utf-8 -*-

import os
import sys
import errno
import logging
import argparse
from collections import deque

from moulinette.core import (init_authenticator, MoulinetteError)

logger = logging.getLogger('moulinette.interface')

GLOBAL_SECTION = '_global'
TO_RETURN_PROP = '_to_return'
CALLBACKS_PROP = '_callbacks'


# Base Class -----------------------------------------------------------

class BaseActionsMapParser(object):
    """Actions map's base Parser

    Each interfaces must implement an ActionsMapParser class derived
    from this class which must overrides virtual properties and methods.
    It is used to parse the main parts of the actions map (i.e. global
    arguments, categories and actions). It implements methods to set/get
    the global and actions configuration.

    Keyword arguments:
        - parent -- A parent BaseActionsMapParser derived object

    """
    def __init__(self, parent=None, **kwargs):
        if parent:
            self._o = parent
        else:
            logger.debug('initializing base actions map parser for %s',
                         self.interface)
            msettings['interface'] = self.interface

            self._o = self
            self._global_conf = {}
            self._conf = {}


    ## Virtual properties
    # Each parser classes must implement these properties.

    """The name of the interface for which it is the parser"""
    interface = None


    ## Virtual methods
    # Each parser classes must implement these methods.

    @staticmethod
    def format_arg_names(name, full):
        """Format argument name

        Format agument name depending on its 'full' parameter and return
        a list of strings which will be used as name or option strings
        for the argument parser.

        Keyword arguments:
            - name -- The argument name
            - full -- The argument's 'full' parameter

        Returns:
            A list of option strings

        """
        raise NotImplementedError("derived class '%s' must override this method" % \
                                      self.__class__.__name__)

    def add_global_parser(self, **kwargs):
        """Add a parser for global arguments
<commit_msg>[fix] forgot to add self to method signature<commit_after># -*- coding: utf-8 -*-

import os
import sys
import errno
import logging
import argparse
from collections import deque

from moulinette.core import (init_authenticator, MoulinetteError)

logger = logging.getLogger('moulinette.interface')

GLOBAL_SECTION = '_global'
TO_RETURN_PROP = '_to_return'
CALLBACKS_PROP = '_callbacks'


# Base Class -----------------------------------------------------------

class BaseActionsMapParser(object):
    """Actions map's base Parser

    Each interfaces must implement an ActionsMapParser class derived
    from this class which must overrides virtual properties and methods.
    It is used to parse the main parts of the actions map (i.e. global
    arguments, categories and actions). It implements methods to set/get
    the global and actions configuration.

    Keyword arguments:
        - parent -- A parent BaseActionsMapParser derived object

    """
    def __init__(self, parent=None, **kwargs):
        if parent:
            self._o = parent
        else:
            logger.debug('initializing base actions map parser for %s',
                         self.interface)
            msettings['interface'] = self.interface

            self._o = self
            self._global_conf = {}
            self._conf = {}


    ## Virtual properties
    # Each parser classes must implement these properties.

    """The name of the interface for which it is the parser"""
    interface = None


    ## Virtual methods
    # Each parser classes must implement these methods.

    @staticmethod
    def format_arg_names(self, name, full):
        """Format argument name

        Format agument name depending on its 'full' parameter and return
        a list of strings which will be used as name or option strings
        for the argument parser.

        Keyword arguments:
            - name -- The argument name
            - full -- The argument's 'full' parameter

        Returns:
            A list of option strings

        """
        raise NotImplementedError("derived class '%s' must override this method" % \
                                      self.__class__.__name__)

    def add_global_parser(self, **kwargs):
        """Add a parser for global arguments

{'fraction_non_alphanumeric': 0.09417239087081763, 'fraction_numerical': 0.00044316419233325947, 'mean_word_length': 2.199149539333806, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3290295', 'n_tokens_mistral': 1100, 'n_tokens_neox': 1052, 'n_words': 438}