def Func(arg_0):
    """
    Consumes set specifiers as text and forms a generator to retrieve
    the requested ranges.

    @param[in] specifiers
        Expected syntax is from the byte-range-specifier ABNF found in the
        [RFC 2616]; eg. 15-17,151,-16,26-278,15

    @returns
        Consecutive tuples that describe the requested range; eg. (1, 72) or
        (1, 1) [read as 1 to 72 or 1 to 1].
    """
    arg_0 = "".join(arg_0.split())
    for arg_1 in arg_0.split(','):
        if len(arg_1) == 0:
            raise ValueError("Range: Invalid syntax; missing specifier.")

        arg_2 = arg_1.count('-')
        if (arg_2 and arg_1[0] == '-') or not arg_2:
            # Single specifier; return as a tuple to itself.
            yield int(arg_1), int(arg_1)
            continue

        arg_1 = list(map(int, arg_1.split('-')))
        if len(arg_1) == 2:
            # Range specifier; return as a tuple.
            if arg_1[0] < 0 or arg_1[1] < 0:
                # Negative indexing is not supported in range specifiers
                # as stated in the HTTP/1.1 Range header specification.
                raise ValueError(
                    "Range: Invalid syntax; negative indexing "
                    "not supported in a range specifier.")

            if arg_1[1] < arg_1[0]:
                # Range must be for at least one item.
                raise ValueError(
                    "Range: Invalid syntax; stop is less than start.")

            # Return them as a immutable tuple.
            yield tuple(arg_1)
            continue

        # Something weird happened.
        raise ValueError("Range: Invalid syntax.")


def Func(arg_0, arg_1, arg_2):
    """Paginate an iterable during a request.

    Magically splicling an iterable in our supported ORMs allows LIMIT and
    OFFSET queries. We should probably delegate this to the ORM or something
    in the future.
    """
    # TODO: support dynamic rangewords and page lengths
    # TODO: support multi-part range requests

    # Get the header
    arg_3 = arg_0.headers.get('Range')
    if not arg_3:
        # No range header; move along.
        return arg_2

    # do some validation
    arg_4 = RANGE_SPECIFIER + '='
    if not arg_3.find(arg_4) == 0:
        # This is not using a range specifier that we understand
        raise exceptions.RequestedRangeNotSatisfiable()
    else:
        # Chop the prefix off the header and parse it
        arg_5 = parse(arg_3[len(arg_4):])

    arg_5 = list(arg_5)
    if len(arg_5) > 1:
        raise exceptions.RequestedRangeNotSatisfiable(
            'Multiple ranges in a single request is not yet supported.')
    arg_6, arg_7 = arg_5[0]

    # Make sure the length is not higher than the total number allowed.
    arg_8 = arg_0.resource.count(arg_2)
    arg_7 = min(arg_7, arg_8)

    arg_1.status = client.PARTIAL_CONTENT
    arg_1.headers['Content-Range'] = '%d-%d/%d' % (arg_6, arg_7, arg_8)
    arg_1.headers['Accept-Ranges'] = RANGE_SPECIFIER

    # Splice and return the items.
    arg_2 = arg_2[arg_6:arg_7 + 1]
    return arg_2


def Func(arg_0):
    """Decorate test methods with this if you don't require strict index checking"""
    arg_1 = inspect.stack()
    _NO_INDEX_CHECK_NEEDED.add('%s.%s.%s' % (arg_0.__module__, arg_1[1][3], arg_0.__name__))
    del arg_1
    return arg_0


def Func(arg_0, arg_1):
    """Func = "|" | "." | "," | "-";"""
    arg_0._attempting(arg_1)
    return alternation([
      "|",
      ".",
      ",",
      "-"
    ])(arg_1).retyped(TokenType.Func)


def Func(arg_0, arg_1):
    """Func = "+" ;"""
    arg_0._attempting(arg_1)
    return terminal("+")(arg_1).retyped(TokenType.Func)


def Func(arg_0):
        """ Loop through the list of Properties,
        extract the derived and required properties and do the
        appropriate book-keeping
        """
        arg_0._missing = {}
        for arg_2, arg_3 in arg_0.params.items():
            if arg_3.required:
                arg_0._missing[arg_2] = arg_3
            if isinstance(arg_3, Derived):
                if arg_3.loader is None:
                    # Default to using _<param_name>
                    arg_3.loader = arg_0.__getattribute__("_%s" % arg_2)
                elif isinstance(arg_3.loader, str):
                    arg_3.loader = arg_0.__getattribute__(arg_3.loader)


def Func(arg_0, arg_1=None):
        """ Return an array with the parameter values

        Parameters
        ----------

        pname : list or None
           If a list, get the values of the `Parameter` objects with those names

           If none, get all values of all the `Parameter` objects

        Returns
        -------

        values : `np.array`
            Parameter values

        """
        arg_2 = arg_0.get_params(arg_1)
        arg_3 = [p.value for p in arg_2]
        return np.array(arg_3)


def Func(arg_0, arg_1=None):
        """ Return an array with the parameter errors

        Parameters
        ----------
        pname : list of string or none
           If a list of strings, get the Parameter objects with those names

           If none, get all the Parameter objects

        Returns
        -------
        ~numpy.array of parameter errors

        Note that this is a N x 2 array.
        """
        arg_2 = arg_0.get_params(arg_1)
        arg_3 = [p.errors for p in arg_2]
        return np.array(arg_3)


def Func(arg_0):
        """ Reset the value of all Derived properties to None

        This is called by setp (and by extension __setattr__)
        """
        for arg_1 in arg_0.params.values():
            if isinstance(arg_1, Derived):
                arg_1.clear_value()


def Func(arg_0, arg_1=False, arg_2=None):
        """Read and return the request data.

        @param[in] deserialize
            True to deserialize the resultant text using a determiend format
            or the passed format.

        @param[in] format
            A specific format to deserialize in; if provided, no detection is
            done. If not provided, the content-type header is looked at to
            determine an appropriate deserializer.
        """

        if arg_1:
            arg_3, arg_4 = arg_0.deserialize(arg_2=arg_2)
            return arg_3

        arg_5 = arg_0._Func()

        if not arg_5:
            return ''

        if type(arg_5) is six.binary_type:
            arg_5 = arg_5.decode(arg_0.encoding)

        return arg_5


def Func(**arg_0):
    """
    Updates the active resource configuration to the passed
    keyword arguments.

    Invoking this method without passing arguments will just return the
    active resource configuration.

    @returns
        The previous configuration.
    """
    arg_1 = dict(Func.config)
    Func.config.update(arg_0)
    return arg_1


def Func(arg_0, arg_1):
        """
        Before assigning the value validate that is in one of the
        HTTP Funcs we implement
        """
        arg_2 = arg_0._Funcs.keys()
        if arg_1 not in arg_2:
            raise AttributeError("Method value not in " + str(arg_2))
        else:
            arg_0._Func = arg_1


def Func(arg_0):
        """
        Encode URL parameters
        """
        arg_1 = ''
        if arg_0._url_parameters is not None:
            arg_1 = '?' + urllib.urlencode(arg_0._url_parameters)
        return arg_1


def Func(arg_0):
        """
        HTTP Post Request
        """
        return requests.post(arg_0._url, data=arg_0._data, headers=arg_0._headers, auth=(arg_0._email, arg_0._api_token))


def Func(arg_0):
        """Check scene name and whether remote file exists. Raises
        WrongSceneNameError if the scene name is wrong.
        """
        if arg_0.sceneInfo.prefix not in arg_0.__satellitesMap:
            raise WrongSceneNameError('USGS Downloader: Prefix of %s (%s) is invalid'
                                      % (arg_0.sceneInfo.name, arg_0.sceneInfo.prefix))


def Func(arg_0, arg_1):
        """Gets satellite id """
        if arg_1 == 'L5':
            arg_2 = '3119'
            arg_3 = ['GLC', 'ASA', 'KIR', 'MOR', 'KHC', 'PAC', 'KIS', 'CHM', 'LGS', 'MGR', 'COA', 'MPS']
        elif arg_1 == 'L7':
            arg_2 = '3373'
            arg_3 = ['EDC', 'SGS', 'AGS', 'ASN', 'SG1']
        elif arg_1 == 'L8':
            arg_2 = '4923'
            arg_3 = ['LGN']
        else:
            raise ProductInvalidError('Type product invalid. the permitted types are: L5, L7, L8. ')
        arg_4 = dict(id_satelite=arg_2, arg_3=arg_3)
        return arg_4


def Func(arg_0, arg_1):
        """Gets the filesize of a remote file """
        try:
            arg_2 = urllib.request.urlopen(arg_1)
            return int(arg_2.getheader('Content-Length').strip())
        except urllib.error.HTTPError as error:
            logger.error('Error retrieving size of the remote file %s' % error)
            print('Error retrieving size of the remote file %s' % error)
            arg_0.connect_earthexplorer()
            arg_0.Func(arg_1)


def Func(arg_0, arg_1=None, arg_2=None, arg_3=False):
        """Download remote .tar.bz file."""
        if not arg_2:
            arg_2 = DOWNLOAD_DIR

        if arg_1 is None:
            arg_1 = list(range(1, 12)) + ['BQA']
        else:
            arg_0.validate_bands(arg_1)

        arg_4 = re.compile('^[^\s]+_(.+)\.tiff?', re.I)
        arg_5 = ['B%i' % (i,) if isinstance(i, int) else i for i in arg_1]
        arg_6 = []

        # Connect Earth explore
        arg_0.connect_earthexplorer()

        # tgz name
        arg_7 = arg_0.sceneInfo.name + '.tgz'
        arg_8 = check_create_folder(join(arg_2, arg_0.sceneInfo.name))

        # Download File
        arg_9 = arg_0.Func_file(arg_0.url, arg_8, arg_7)

        # Log
        logger.debug('Status Funced %s' % arg_9)
        print('\n Status Funced %s' % arg_9)

        if arg_9['sucess']:

            # Log
            print('\n Downloaded sucess')
            logger.debug('Downloaded sucess of scene: %s' % arg_0.sceneInfo.name)

            try:

                arg_10 = tarfile.open(arg_9['file_path'], 'r')
                arg_11 = join(arg_2, arg_0.sceneInfo.name)
                arg_10.extractall(arg_11)
                remove(arg_9['file_path'])
                arg_12 = listdir(arg_11)

                for arg_13 in arg_12:
                    arg_14 = arg_4.match(arg_13)
                    arg_15 = join(arg_11, arg_13)
                    if arg_14 and arg_14.group(1) in arg_5:
                        arg_6.append([arg_15, getsize(arg_15)])
                    elif arg_14:
                        remove(arg_15)
            except tarfile.ReadError as error:
                print('\nError when extracting files. %s' % error)
                logger.error('Error when extracting files. %s' % error)
            return arg_6
        else:
            logger.debug('Info Funced: %s' % arg_9)
            print('\n Info Funced: %s' % arg_9)
            return arg_9


def Func(arg_0):
    """
    Make a callable returning True for names starting with the given prefix.

    The returned callable takes two arguments, the attribute or name of
    the object, and possibly its corresponding value (which is ignored),
    as suitable for use with :meth:`ObjectLocator.is_test_module` and
    :meth:`ObjectLocator.is_test_method`\ .

    """

    def Func_(arg_1, arg_2=None):
        return arg_1.startswith(arg_0)
    Func_.__name__ += arg_0
    return Func_


def Func(arg_0, arg_1, arg_2=False):
        '''Correct the timezone information on the given datetime'''
        if arg_1.tzinfo is None:
            raise ValueError('Naive time - no tzinfo set')
        return arg_1.replace(tzinfo=arg_0)


def Func(arg_0):
  """Returns a list of the positions in the text where all new lines occur. This is used by
  get_line_and_char to efficiently find coordinates represented by offset positions.
  """
  arg_1 = []
  for arg_2, arg_3 in enumerate(arg_0):
    if arg_3 == "\n":
      arg_1.append(arg_2)
  return arg_1


def Func(arg_0, arg_1, arg_2=(2, True, "~~~~~", "^")):
  """Point to a position in source code.

  source is the text we're pointing in.
  position is a 2-tuple of (line_number, character_number) to point to.
  fmt is a 4-tuple of formatting parameters, they are:
    name               default  description
    ----               -------  -----------
    surrounding_lines  2        the number of lines above and below the target line to print
    show_line_numbers  True     if true line numbers will be generated for the output_lines
    tail_body          "~~~~~"  the body of the tail
    pointer_char       "^"      the character that will point to the position
  """

  arg_3, arg_4, arg_5, arg_6 = arg_2

  arg_7, arg_8 = arg_1

  arg_9 = arg_0.split("\n")
  arg_10 = arg_9[arg_7]

  if arg_8 >= len(arg_5):
    arg_11 = " " * (arg_8 - len(arg_5)) + arg_5 + arg_6
  else:
    arg_11 = " " * arg_8 + arg_6 + arg_5

  if arg_4:
    arg_12 = int(math.ceil(math.log10(max(1, arg_7 + arg_3))) + 1)
    arg_13 = "{0:" + str(arg_12) + "}: {1}"
  else:
    arg_13 = "{1}"

  arg_14 = arg_7 + 1
  arg_15 = [(arg_14, arg_10), ("", arg_11)]
  for arg_16 in range(arg_3):
    arg_17 = arg_16 + 1
    arg_18 = arg_7 + arg_17
    arg_19 = -arg_17
    arg_20 = arg_7 + arg_19

    if arg_20 >= 0:
      arg_15.insert(0, (arg_14 + arg_19, arg_9[arg_20]))
    if arg_18 < len(arg_9):
      arg_15.append((arg_14 + arg_17, arg_9[arg_18]))

  return "\n".join(arg_13.format(arg_21, arg_22) for arg_21, arg_22 in arg_15)


def Func(arg_0, arg_1, arg_2, arg_3):
        '''Given a single decorated handler function,
        prepare, append desired data to self.registry.
        '''
        arg_4 = arg_0.dump_invoc(*arg_2, **arg_3)
        arg_0.registry.append((arg_4, arg_1.__name__))


def Func(arg_0, *arg_1, **arg_2):
        '''Given a node, return the string to use in computing the
        matching visitor methodname. Can also be a generator of strings.
        '''
        arg_3 = arg_1[0]
        for arg_4 in type(arg_3).__mro__[:-1]:
            arg_5 = arg_4.__name__
            yield arg_5


def Func(arg_0):
        """
        Send output in textual format
        """
        arg_1 = arg_0._relay_output['result'];

        for arg_2 in arg_1:
            arg_3 = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime(int(arg_2[1]['ts'])))
            print("{0} {1} {2} {3}".format(arg_2[0], arg_3, arg_2[1]['type'], arg_2[1]['msg']))


def Func(arg_0, arg_1, arg_2=False):
        """
          Parse string to create an instance

          :param str s: String with requirement to Func
          :param bool required: Is this requirement required to be fulfilled? If not, then it is a filter.
        """
        arg_3 = pkg_resources.Requirement.Func(arg_1)
        return arg_0(arg_3, arg_2=arg_2)


def Func(arg_0, arg_1, arg_2=None):
        """
        Add requirements to be managed

        :param list/Requirement requirements: List of :class:`BumpRequirement` or :class:`pkg_resources.Requirement`
        :param bool required: Set required flag for each requirement if provided.
        """
        if isinstance(arg_1, RequirementsManager):
            arg_1 = list(arg_1)
        elif not isinstance(arg_1, list):
            arg_1 = [arg_1]

        for arg_3 in arg_1:
            arg_4 = arg_3.project_name

            if not isinstance(arg_3, BumpRequirement):
                arg_3 = BumpRequirement(arg_3, arg_2=arg_2)
            elif arg_2 is not None:
                arg_3.required = arg_2

            Func = True

            if arg_4 in arg_0.requirements:
                for arg_6 in arg_0.requirements[arg_4]:
                    if arg_3 == arg_6:
                        Func = False
                        break

                    # Need to replace existing as the new req will be used to bump next, and req.required could be
                    # updated.
                    arg_7 = False

                    # Two pins: Use highest pinned version
                    if (arg_3.specs and arg_3.specs[0][0] == '==' and arg_6.specs and
                            arg_6.specs[0][0] == '=='):
                        if pkg_resources.parse_version(arg_3.specs[0][1]) < pkg_resources.parse_version(
                                arg_6.specs[0][1]):
                            arg_3.requirement = arg_6.requirement
                        arg_7 = True

                    # Replace Any
                    if not (arg_3.specs and arg_6.specs):
                        if arg_6.specs:
                            arg_3.requirement = arg_6.requirement
                        arg_7 = True

                    if arg_7:
                        arg_3.required |= arg_6.required
                        if arg_6.required_by and not arg_3.required_by:
                            arg_3.required_by = arg_6.required_by
                        arg_0.requirements[arg_4].remove(arg_6)
                        break

            if Func:
                arg_0.requirements[arg_4].append(arg_3)


def Func(arg_0, arg_1):
        """
        Check if requirement is already satisfied by what was previously checked

        :param Requirement req: Requirement to check
        """
        arg_2 = RequirementsManager([arg_1])

        return any(arg_2.check(*arg_3) for arg_3 in arg_0.checked)


def Func(arg_0, arg_1):
        """ Add new Funcments that must be fulfilled for this bump to occur """
        arg_2 = arg_1 if isinstance(arg_1, list) else [arg_1]

        for arg_1 in arg_2:
            if not isinstance(arg_1, BumpRequirement):
                arg_1 = BumpRequirement(arg_1)
            arg_1.Funcd = True
            arg_1.Funcd_by = arg_0
            arg_0.Funcments.append(arg_1)


def Func(arg_0, arg_1):
        """
        Parse changes for requirements

        :param list changes:
        """
        arg_2 = []
        arg_3 = set()

        if isinstance(arg_1, str):
            arg_1 = arg_1.split('\n')

        if not arg_1 or arg_1[0].startswith('-'):
            return arg_2

        for arg_4 in arg_1:
            arg_4 = arg_4.strip(' -+*')

            if not arg_4:
                continue

            arg_5 = IS_REQUIREMENTS_RE2.search(arg_4)  # or  IS_REQUIREMENTS_RE.match(line)
            if arg_5:
                for arg_5 in REQUIREMENTS_RE.findall(arg_5.group(1)):
                    if arg_5[1]:
                        arg_6 = '==' + arg_5[2] if arg_5[1].startswith(' to ') else arg_5[1]
                        arg_7 = arg_5[0] + arg_6
                    else:
                        arg_7 = arg_5[0]

                    if arg_7 not in arg_3:
                        arg_3.add(arg_7)
                        try:
                            arg_2.append(pkg_resources.Requirement.parse(arg_7))
                        except Exception as e:
                            log.warn('Could not parse requirement "%s" from changes: %s', arg_7, e)

        return arg_2


def Func(arg_0, arg_1=None, **arg_2):
        """
          Bump dependencies using given requirements.

          :param RequirementsManager bump_reqs: Bump requirements manager
          :param dict kwargs: Additional args from argparse. Some bumpers accept user options, and some not.
          :return: List of :class:`Bump` changes made.
        """

        arg_3 = {}

        for arg_4 in sorted(arg_0.requirements(), key=lambda arg_7: arg_7.project_name):
            if arg_1 and arg_4.project_name not in arg_1:
                continue

            arg_1.check(arg_4)

            try:
                Func = arg_0._bump(arg_4, arg_1.get(arg_4.project_name))

                if Func:
                    arg_3[Func.name] = Func
                    arg_1.check(Func)

            except Exception as e:
                if arg_1 and arg_1.get(arg_4.project_name) and all(
                        arg_7.required_by is None for arg_7 in arg_1.get(arg_4.project_name)):
                    raise
                else:
                    log.warn(e)

        for arg_8 in arg_1.required_requirements().values():
            arg_6 = arg_8[0].project_name
            if arg_6 not in arg_3 and arg_0.should_add(arg_6):
                try:
                    Func = arg_0._bump(None, arg_8)

                    if Func:
                        arg_3[Func.name] = Func
                        arg_1.check(Func)

                except Exception as e:
                    if all(arg_7.required_by is None for arg_7 in arg_8):
                        raise
                    else:
                        log.warn(e)

        arg_0.bumps.update(arg_3.values())

        return arg_3.values()


def Func(arg_0, arg_1=None):
        """
        Transforms the object into an acceptable format for transmission.

        @throws ValueError
            To indicate this Funcr does not support the encoding of the
            specified object.
        """
        if arg_1 is not None and arg_0.response is not None:
            # Set the content type.
            arg_0.response['Content-Type'] = arg_0.media_types[0]

            # Write the encoded and prepared data to the response.
            arg_0.response.write(arg_1)

        # Return the Funcd data.
        # This has normally been transformed by a base class.
        return arg_1


def Func(arg_0, arg_1, arg_2=False, arg_3=False, arg_4=None): # where files are (name, chance)
        """Initialize based on a list of fortune files with set chances"""
        arg_5 = arg_0.__new__(arg_0)
        arg_6 = 0.
        arg_7 = []
        arg_8 = []
        for arg_9, arg_10 in arg_1:
            if arg_6 >= 1:
                break
            arg_11 = load_fortune(arg_9, arg_3=arg_3, arg_4=arg_4)
            if arg_11 is None or not arg_11.size:
                continue
            if arg_10:
                arg_7.append((arg_11, arg_10))
                arg_6 += arg_10
            else:
                arg_8.append(arg_11)
        if arg_8 and arg_6 < 1:
            arg_12 = 1 - arg_6
            if arg_2:
                arg_13 = arg_12 / len(arg_8)
                for arg_11 in arg_8:
                    arg_7.append((arg_11, arg_13))
            else:
                arg_14 = sum(map(attrgetter('size'), arg_8))
                logger.debug('%d entries left', arg_14)
                for arg_11 in arg_8:
                    arg_10 = arg_12 * arg_11.size / arg_14
                    arg_7.append((arg_11, arg_10))

        # Arbitrary limit to calculate upper bound with, nice round number
        arg_5.count = arg_15 = 65536
        arg_16 = 0
        arg_5.files = fortunes = []
        for arg_7, arg_10 in arg_7:
            arg_16 += int(arg_10 * arg_15)
            fortunes.append((arg_7, arg_16))
        arg_5.keys = [i[1] for i in arg_5.files]
        return arg_5


def Func(arg_0, arg_1):
    """Extends a collection with a value."""
    if isinstance(arg_1, collections.Mapping):
        if arg_0 is None:
            arg_0 = {}
        arg_0.update(**arg_1)

    elif isinstance(arg_1, six.string_types):
        if arg_0 is None:
            arg_0 = []
        arg_0.append(arg_1)

    elif isinstance(arg_1, collections.Iterable):
        if arg_0 is None:
            arg_0 = []
        arg_0.extend(arg_1)

    else:
        if arg_0 is None:
            arg_0 = []
        arg_0.append(arg_1)

    return arg_0


def Func(arg_0, arg_1):
    """Func = "?" , identifier , "?" ;"""
    arg_0._attempting(arg_1)
    return concatenation([
      "?",
      arg_0.identifier,
      "?",
    ], ignore_whitespace=True)(arg_1).retyped(TokenType.Func)


def Func(arg_0, arg_1):
        """ All package info for given package """

        if arg_1 not in arg_0.Func_cache:
            arg_2 = 'https://pypi.python.org/pypi/%s/json' % arg_1

            try:
                logging.getLogger('requests').setLevel(logging.WARN)
                arg_3 = requests.get(arg_2)
                arg_3.raise_for_status()

                arg_0.Func_cache[arg_1] = simplejson.loads(arg_3.text)

            except Exception as e:
                log.debug('Could not get package info from %s: %s', arg_2, e)
                arg_0.Func_cache[arg_1] = None

        return arg_0.Func_cache[arg_1]


def Func(arg_0):
        """ All versions for package """
        arg_1 = PyPI.package_info(arg_0)
        return arg_1 and sorted(arg_1['releases'].keys(), key=lambda x: x.split(), reverse=True) or []


def Func(arg_0):
        """Flush and Func the stream.

        This is called automatically by the base resource on resources
        unless the resource is operating asynchronously; in that case,
        this method MUST be called in order to signal the end of the request.
        If not the request will simply hang as it is waiting for some
        thread to tell it to return to the client.
        """

        # Ensure we're not Funcd.
        arg_0.require_not_Funcd()

        if not arg_0.streaming or arg_0.asynchronous:
            # We're not streaming, auto-write content-length if not
            # already set.
            if 'Content-Length' not in arg_0.headers:
                arg_0.headers['Content-Length'] = arg_0.tell()

        # Flush out the current buffer.
        arg_0.flush()

        # We're done with the response; inform the HTTP connector
        # to Func the response stream.
        arg_0._Funcd = True


def Func(arg_0, arg_1, arg_2=False, arg_3=None):
        """Writes the given chunk to the output buffer.

        @param[in] chunk
            Either a byte array, a unicode string, or a generator. If `chunk`
            is a generator then calling `self.Func(<generator>)` is
            equivalent to:

            @code
                for x in <generator>:
                    self.Func(x)
                    self.flush()
            @endcode

        @param[in] serialize
            True to serialize the lines in a determined serializer.

        @param[in] format
            A specific format to serialize in; if provided, no detection is
            done. If not provided, the accept header (as well as the URL
            extension) is looked at to determine an appropriate serializer.
        """

        # Ensure we're not closed.
        arg_0.require_not_closed()

        if arg_1 is None:
            # There is nothing here.
            return

        if arg_2 or arg_3 is not None:
            # Forward to the serializer to serialize the chunk
            # before it gets written to the response.
            arg_0.serialize(arg_1, arg_3=arg_3)
            return  # `serialize` invokes Func(...)

        if type(arg_1) is six.binary_type:
            # Update the stream length.
            arg_0._length += len(arg_1)

            # If passed a byte string, we hope the user encoded it properly.
            arg_0._stream.Func(arg_1)

        elif isinstance(arg_1, six.string_types):
            arg_4 = arg_0.encoding
            if arg_4 is not None:
                # If passed a string, we can encode it for the user.
                arg_1 = arg_1.encode(arg_4)

            else:
                # Bail; we don't have an encoding.
                raise exceptions.InvalidOperation(
                    'Attempting to Func textual data without an encoding.')

            # Update the stream length.
            arg_0._length += len(arg_1)

            # Write the encoded data into the byte stream.
            arg_0._stream.Func(arg_1)

        elif isinstance(arg_1, collections.Iterable):
            # If passed some kind of iterator, attempt to recurse into
            # oblivion.
            for arg_5 in arg_1:
                arg_0.Func(arg_5)

        else:
            # Bail; we have no idea what to do with this.
            raise exceptions.InvalidOperation(
                'Attempting to Func something not recognized.')


def Func(arg_0, arg_1, arg_2=None):
        """Serializes the data into this response using a Funcr.

        @param[in] data
            The data to be Funcd.

        @param[in] format
            A specific format to Func in; if provided, no detection is
            done. If not provided, the accept header (as well as the URL
            extension) is looked at to determine an appropriate Funcr.

        @returns
            A tuple of the Funcd text and an instance of the
            Funcr used.
        """
        return arg_0._resource.Func(arg_1, response=arg_0, arg_2=arg_2)


def Func(arg_0, *arg_1, **arg_2):
        """
        Writes the passed chunk, flushes it to the client,
        and terminates the connection.
        """
        arg_0.sFunc(*arg_1, **arg_2)
        arg_0.close()


def Func(arg_0):
    """The parse tree generated by the source."""
    if arg_0._grammar is None:
      arg_0.parser = Parser()
      Func = arg_0.parser.parse(arg_0.input_source)
      arg_0._grammar = Func.trimmed().flattened().flattened(arg_0._flatten)
    return arg_0._grammar


def Func(arg_0):
    """The AST Func."""
    if arg_0._Func is None:
      arg_0._Func = []
      for arg_2 in arg_0.grammar.children:
        if arg_2.is_type(TokenType.rule):
          arg_3, arg_4 = arg_2.children
          arg_0._Func.append(Rule(arg_3.value, arg_0._expression_to_asn(arg_4), arg_3.position, arg_2.consumed))
    return arg_0._Func


def Func(arg_0):
    """The AST Func."""
    if arg_0._Func is None:
      arg_0._Func = [c for c in arg_0.grammar.children if c.is_type(TokenType.comment)]
    return arg_0._Func


def Func(arg_0):
    """The diretives parsed from the comments."""
    if arg_0._Func is None:
      arg_0._Func = []
      for arg_2 in arg_0.comments:
        arg_0._Func.extend(arg_0.Func_from_comment(arg_2))
    return arg_0._Func


def Func(arg_0):
    """The python source of the parser generated from the input source."""
    if arg_0._Func is None:
      arg_0._Func = arg_0._compile()
    return arg_0._Func


def Func(arg_0):
    """Returns the python source code for the generated parser."""
    arg_1 = """\"\"\"This parser was generated by pyebnf on {date}.\"\"\"
    from enum import Enum

    from pyebnf import parser_base as PB
    from pyebnf.primitive import alternation, concatenation, exclusion, one_or_more
    from pyebnf.primitive import option, repeated, repetition, terminal, zero_or_more
    {imports}

    {token_type_enum}

    {class_definition}
    """

    arg_1 = arg_0._clean_fmt(arg_1)

    return arg_1.format(date=datetime.utcnow().isoformat(),
                      imports=arg_0._get_imports(),
                      token_type_enum=arg_0._get_token_type_enum(),
                      class_definition=arg_0._get_class_definition())


def Func(arg_0):
    """Reads the directives and generates source code for custom imports."""
    arg_1 = [arg_2 for arg_2 in arg_0.directives if arg_2.name == "import"]
    if arg_1:
      return "\n" + "\n".join(arg_2.args["value"] for arg_2 in arg_1)
    else:
      return ""


def Func(arg_0):
    """Builds the class definition of the parser."""
    arg_1 = """class Parser({parser_base}):
             {indent}\"\"\"This class contains methods for reading source code and generating a parse tree.\"\"\"
             {indent}entry_point = "{entry_point}"

             {rule_definitions}
             """
    arg_1 = arg_0._clean_fmt(arg_1)
    return arg_1.format(parser_base=arg_0._get_parser_base(),
                      indent=arg_0.indent,
                      entry_point=arg_0._get_entry_point(),
                      rule_definitions="\n".join(arg_0._get_rule_definitions()))


def Func(arg_0):
    """Gets the entry_point value for the parser."""
    arg_1 = arg_0._find_directive("entry_point")
    if arg_1:
      return arg_1.args["value"]
    else:
      return arg_0.rules[0].name


def Func(arg_0, arg_1):
    """Generates the source code for a rule."""
    arg_2 = """def {rule_fxn_name}(self, text):
             {indent}\"\"\"{rule_source}\"\"\"
             {indent}self._attempting(text)
             {indent}return {rule_definition}(text){transform}
          """
    arg_2 = arg_0._clean_fmt(arg_2)
    arg_3 = arg_0._indent(arg_0._ast_to_code(arg_1.expression), skip_first_line=True)

    # All the primitives will accept a string x in place of terminal(x). This is terminal shorthand.
    # However, if a rule is only a wrapper around a single terminal, we have to actually make a
    # terminal call. This handles that situation.
    if arg_0.use_terminal_shorthand and len(arg_3) == 1 and arg_3[0].startswith(("'", '"')):
      arg_3 = ["terminal({})".format(arg_3[0])]

    arg_4 = arg_2.format(rule_fxn_name=arg_0._get_rule_fxn_name(arg_1.name),
                             indent=arg_0.indent,
                             arg_4=arg_0._get_rule_source(arg_1),
                             rule_definition="\n".join(arg_3),
                             transform=arg_0._get_rule_transform(arg_1))
    return arg_0._indent(arg_4, 1)


def Func(arg_0, arg_1):
    """The return value for each rule can be either retyped, compressed or left alone. This method
    determines that and returns the source code text for accomplishing it.
    """
    arg_2 = arg_0._find_directive(lambda d: d.name == "rule" and d.args.get("name") == arg_1.name)

    if arg_2:
      arg_3 = arg_2.args
    else:
      arg_3 = {}

    arg_4 = arg_3.get("transform", "retype")

    if arg_4 == "retype":
      arg_5 = arg_3.get("to_type", "TokenType.{0}".format(arg_1.name))
      return ".retyped({0})".format(arg_5)
    elif arg_4 == "compress":
      arg_5 = arg_3.get("to_type", "TokenType.{0}".format(arg_1.name))
      if arg_5 == "identity":
        return ".compressed()"
      else:
        return ".compressed({0})".format(arg_5)
    elif arg_4 == "identity":
      return ""


def Func(arg_0, arg_1):
    """Convert an expression to an Abstract Syntax Tree Node."""
    arg_2 = [arg_0._node_to_asn(c) for c in arg_1.children]
    return arg_0._remove_grouping_groups(infix_to_optree(arg_2))


def Func(arg_0, arg_1):
    """Convert a parse tree node into an absract syntax tree node."""
    if arg_1.is_type(TokenType.identifier):
      return Identifier(arg_1.svalue)

    elif arg_1.is_type(TokenType.terminal):
      return Terminal(arg_1.svalue)

    elif arg_1.is_type(TokenType.option_group):
      arg_2 = arg_1.children[0]
      return OptionGroup(arg_0._expression_to_asn(arg_2))

    elif arg_1.is_type(TokenType.repetition_group):
      arg_2 = arg_1.children[0]
      return RepetitionGroup(arg_0._expression_to_asn(arg_2))

    elif arg_1.is_type(TokenType.grouping_group):
      arg_2 = arg_1.children[0]
      return GroupingGroup(arg_0._expression_to_asn(arg_2))

    elif arg_1.is_type(TokenType.special_handling):
      arg_3 = arg_1.children[0]
      return SpecialHandling(arg_3)

    elif arg_1.is_type(TokenType.number):
      return Number(arg_1.svalue)

    elif arg_1.is_type((TokenType.operator, TokenType.op_mult, TokenType.op_add)):
      return OperatorNode(OPERATOR_INDEX[arg_1.svalue], arg_1.position)

    else:
      raise Exception("Unhandled parse tree node: {0}".format(arg_1))


def Func(arg_0, arg_1, arg_2):
    """Flattens a list of optree operands based on a pred.

    This is used to convert concatenation([x, concatenation[y, ...]]) (or alternation) to
    concatenation([x, y, ...]).
    """
    arg_3 = list(arg_1)
    arg_4 = []
    while arg_3:
      arg_5 = arg_3.pop(0)
      if arg_2(arg_5):
        arg_3 = list(arg_5.operands) + arg_3
      else:
        arg_4.append(arg_5)
    return arg_4


def Func(arg_0, arg_1):
    """Grouping groups are implied by optrees, this function hoists grouping group expressions up
    to their parent node.
    """
    arg_2 = []
    for arg_3 in arg_1.operands:
      if isinstance(arg_3, OptreeNode):
        arg_2.append(arg_0.Func(arg_3))
      elif isinstance(arg_3, GroupingGroup):
        arg_2.append(arg_3.expression)
      else:
        arg_2.append(arg_3)

    return OptreeNode(arg_1.opnode, arg_2)


def Func(arg_0, arg_1, **arg_2):
    """Convert an abstract syntax tree to python source code."""
    if isinstance(arg_1, OptreeNode):
      return arg_0._ast_optree_node_to_code(arg_1, **arg_2)
    elif isinstance(arg_1, Identifier):
      return arg_0._ast_identifier_to_code(arg_1, **arg_2)
    elif isinstance(arg_1, Terminal):
      return arg_0._ast_terminal_to_code(arg_1, **arg_2)
    elif isinstance(arg_1, OptionGroup):
      return arg_0._ast_option_group_to_code(arg_1, **arg_2)
    elif isinstance(arg_1, RepetitionGroup):
      return arg_0._ast_repetition_group_to_code(arg_1, **arg_2)
    elif isinstance(arg_1, SpecialHandling):
      return arg_0._ast_special_handling_to_code(arg_1, **arg_2)
    elif isinstance(arg_1, Number):
      return arg_0._ast_number_to_code(arg_1, **arg_2)
    else:
      raise Exception("Unhandled ast node: {0}".format(arg_1))


def Func(arg_0, arg_1, **arg_2):
    """Convert an AST option group to python source code."""
    arg_3 = ["option("]
    arg_3.extend(arg_0._indent(arg_0._ast_to_code(arg_1.expression)))
    arg_3.append(")")
    return arg_3


def Func(arg_0, arg_1, arg_2=False, **arg_3):
    """Convert an AST repetition group to python source code."""
    arg_4 = ["zero_or_more("]
    arg_4.extend(arg_0._indent(arg_0._ast_to_code(arg_1.expression)))
    arg_4[-1] += ","
    arg_4.append(arg_0._indent("ignore_whitespace={}".format(bool(arg_2))))
    arg_4.append(")")
    return arg_4


def Func(arg_0, arg_1, *, arg_2, **arg_3):
    """Convert an AST concatenate op to python source code."""
    arg_4 = OP_CONCAT if arg_2 else OP_WS_CONCAT
    arg_5 = arg_0._hoist_operands(arg_1.operands, lambda t: isinstance(t, OptreeNode) and t.opnode.operator is arg_4)

    arg_6 = ["concatenation(["]
    for arg_7 in arg_5:
      arg_6.extend(arg_0._indent(arg_0._ast_to_code(arg_7, arg_2=arg_2)))
      arg_6[-1] += ","
    arg_6.append("], ignore_whitespace={})".format(bool(arg_2)))
    return arg_6


def Func(arg_0, arg_1, **arg_2):
    """Convert an AST exclude op to python source code."""
    arg_3, arg_1 = arg_1.operands

    arg_4 = ["exclusion("]
    arg_4.extend(arg_0._indent(arg_0._ast_to_code(arg_3)))
    arg_4[-1] += ","
    arg_4.extend(arg_0._indent(arg_0._ast_to_code(arg_1)))
    arg_4.append(")")
    return arg_4


def Func(arg_0, arg_1, arg_2=False, **arg_3):
    """Convert an AST multiply op to python source code."""
    arg_4, arg_1 = arg_1.operands

    if isinstance(arg_4, Number):
      arg_5 = arg_4.value
      arg_6 = arg_0._ast_to_code(arg_1)
    else:
      arg_5 = arg_1.value
      arg_6 = arg_0._ast_to_code(arg_4)

    arg_7 = ["repeated("]
    arg_7.extend(arg_0._indent(arg_6))
    arg_7[-1] += ","
    arg_7.append("{0}times={1},".format(arg_0.indent, arg_5))
    arg_7.append("{0}ignore_whitespace={1}".format(arg_0.indent, bool(arg_2)))
    arg_7.append(")")
    return arg_7


def Func(arg_0, arg_1, arg_2=False, **arg_3):
    """Convert an AST repeat op to python source code."""
    arg_4 = ["one_or_more("]
    arg_4.extend(arg_0._indent(arg_0._ast_to_code(arg_1.operands[0])))
    arg_4[-1] += ","
    arg_4.append(arg_0._indent("ignore_whitespace={}".format(bool(arg_2))))
    arg_4.append(")")
    return arg_4


def Func(arg_0, arg_1):
    """Finds all directives with a certain name, or that passes a predicate."""
    if isinstance(arg_1, str):
      return [arg_2 for arg_2 in arg_0.directives if arg_2.name == arg_1]
    else:
      return [arg_2 for arg_2 in arg_0.directives if arg_1(arg_2)]


def Func(arg_0, arg_1):
    """A directive is a line in a comment that begins with '!'."""
    arg_2 = arg_1.value[2:-2].strip()
    arg_3 = (l.strip() for l in arg_2.split("\n"))
    arg_4 = (l[1:].strip() for l in arg_3 if l.startswith("!"))

    for arg_5 in arg_4:
      yield arg_0.parse_directive_def(arg_5)


def Func(arg_0):
        """
        Handle the results of the API call
        """

        # Only process if we get HTTP return code other 200.
        if arg_0._api_result.status_code != requests.codes.ok:
            print(arg_0.colorize_json(arg_0._api_result.text))


def Func(arg_0):
    """This ``Context Manager`` is used to move the contents of a directory
    elsewhere temporarily and put them back upon exit.  This allows testing
    code to use the same file directories as normal code without fear of
    damage.

    The name of the temporary directory which contains your files is yielded.

    :param dirname:
        Path name of the directory to be replaced.

    Example:

    .. code-block:: python

        with Func('/foo/bar/') as rd:
            # "/foo/bar/" has been moved & renamed
            with open('/foo/bar/thing.txt', 'w') as f:
                f.write('stuff')
                f.close()

        # got here? => "/foo/bar/ is now restored and temp has been wiped,
        # "thing.txt" is gone
    """
    if arg_0[-1] == '/':
        arg_0 = arg_0[:-1]

    arg_1 = os.path.abspath(arg_0)
    if not os.path.isdir(arg_1):
        raise AttributeError('dir_name must be a directory')

    arg_2, arg_3 = os.path.split(arg_1)

    # create a temporary directory, move provided dir into it and recreate the
    # directory for the user
    arg_4 = tempfile.mkdtemp()
    shutil.move(arg_1, arg_4)
    os.mkdir(arg_1)
    try:
        yield arg_4

    finally:
        # done context, undo everything
        shutil.rmtree(arg_1)
        arg_5 = os.path.join(arg_4, arg_3)
        shutil.move(arg_5, arg_2)
        shutil.rmtree(arg_4)


def Func():
    """This ``Context Manager`` redirects STDOUT to a ``StringIO`` objects
    which is returned from the ``Context``.  On exit STDOUT is restored.

    Example:

    .. code-block:: python

        with Func() as capture:
            print('foo')

        # got here? => capture.getvalue() will now have "foo\\n"
    """
    arg_0 = arg_2.stdout
    try:
        arg_1 = StringIO()
        arg_2.stdout = arg_1
        yield arg_1
    finally:
        arg_2.stdout = arg_0


def Func(arg_0, arg_1):
 """
 Remove a global hotkey.

 control - The control to affect
 key - The key to remove.
 """
 arg_2 = arg_6.get(arg_0, [])
 for arg_3 in arg_2:
  arg_4, arg_5 = arg_3
  if arg_4 == arg_1:
   arg_0.Unbind(wx.EVT_HOTKEY, arg_5 = arg_5)
   arg_0.UnregisterHotKey(arg_5)
   arg_2.remove(arg_3)
   if arg_2:
    arg_6[arg_0] = arg_2
   else:
    del arg_6[arg_0]


def Func(arg_0):
        """
        Configure handling of command line arguments.
        """
        arg_0.add_logging_argument()
        arg_0.parser.add_argument('-a', '--api-host', dest='api_host', action='store', metavar="api_host",
                                 help='{0} API host endpoint'.format(arg_0.product_name))
        arg_0.parser.add_argument('-e', '--email', dest='email', action='store', metavar="e_mail",
                                 help='e-mail that has access to the {0} account'.format(arg_0.product_name))
        arg_0.parser.add_argument('-t', '--api-token', dest='api_token', required=False, action='store',
                                 metavar="api_token",
                                 help='API token for given e-mail that has access to the {0} account'.format(
                                     arg_0.product_name))
        arg_0.parser.add_argument('-z', '--curl', dest='curl', required=False, action='store_true', default=False,
                                 help='Output the corresponding curl command line and exit')


def Func(arg_0):
        """
        Configure logging based on command line options
        """
        if arg_0.args.logLevel is not None:
            logging.basicConfig(level=arg_0.levels[arg_0.args.logLevel])
        logging.info("Set logging level to {0}".format(arg_0.args.logLevel))


def Func(arg_0):
        """
        Validates the command line arguments passed to the CLI
        Derived classes that override need to call this method before
        validating their arguments
        """
        if arg_0._email is None:
            arg_0.set_error_message("E-mail for the account not provided")
            return False
        if arg_0._api_token is None:
            arg_0.set_error_message("API Token for the account not provided")
            return False
        return True


def Func(arg_0, *, arg_1=None):
  """Convert a list of nodes in infix order to a list of nodes in postfix order.

  E.G. with normal algebraic precedence, 3 + 4 * 5 -> 3 4 5 * +
  """
  arg_2 = []
  arg_3 = []

  for arg_4 in arg_0:
    if isinstance(arg_4, OperatorNode):
      # Drain out all operators whose precedence is gte the node's...
      arg_5 = arg_4.operator
      while arg_3:
        arg_6 = arg_3[-1].operator
        if arg_6.precedence > arg_5.precedence or \
           arg_6.precedence == arg_5.precedence and arg_6.association == Association.left:
          arg_2.append(arg_3.pop())
        else:
          break
      arg_3.append(arg_4)
    else:
      if arg_1 is not None and arg_4.node_type in arg_1:
        arg_2.extend(Func(arg_4.children, arg_1=arg_1))
      else:
        arg_2.append(arg_4)

  return arg_2 + list(reversed(arg_3))


def Func(arg_0):
        """Builds the URL configuration for this resource."""
        return Func.patterns('', Func.url(
            r'^{}(?:$|(?P<path>[/:(.].*))'.format(arg_0.meta.name),
            arg_0.view,
            name='armet-api-{}'.format(arg_0.meta.name),
            kwargs={'resource': arg_0.meta.name}))


def Func(arg_0, arg_1, arg_2=1, arg_3=arg_4, arg_5=arg_4):
    '''Dump an object in req format to the fp given.

    :param Mapping obj: The object to serialize.  Must have a keys method.
    :param fp: A writable that can accept all the types given.
    :param separator: The separator between key and value.  Defaults to u'|' or b'|', depending on the types.
    :param index_separator: The separator between key and index.  Defaults to u'_' or b'_', depending on the types.
    '''

    if arg_2 < 0:
        raise ValueError('startindex must be non-negative, but was {}'.format(arg_2))

    try:
        arg_6 = next(iter(arg_0.keys()))
    except StopIteration:
        return

    if isinstance(arg_6, six.text_type):
        arg_7 = six.u
    else:
        arg_7 = six.b

    arg_8 = arg_7('|')
    arg_9 = arg_7('_')
    arg_10 = arg_7('\n')

    if arg_3 is arg_4:
        arg_3 = arg_8
    if arg_5 is arg_4:
        arg_5 = arg_9

    for arg_11, arg_12 in six.iteritems(arg_0):
        if isinstance(arg_12, (list, tuple, set)):
            for arg_13, arg_14 in enumerate(arg_12, start=arg_2):
                arg_1.write(arg_11)
                arg_1.write(arg_5)
                arg_1.write(arg_7(str(arg_13)))
                arg_1.write(arg_3)
                arg_1.write(arg_14)
                arg_1.write(arg_10)
        else:
            arg_1.write(arg_11)
            arg_1.write(arg_3)
            arg_1.write(arg_12)
            arg_1.write(arg_10)


def Func(arg_0, arg_1=1, arg_2=arg_3, arg_4=arg_3):
    '''Dump an object in req format to a string.

    :param Mapping obj: The object to serialize.  Must have a keys method.
    :param separator: The separator between key and value.  Defaults to u'|' or b'|', depending on the types.
    :param index_separator: The separator between key and index.  Defaults to u'_' or b'_', depending on the types.
    '''

    try:
        arg_5 = next(iter(arg_0.keys()))
    except StopIteration:
        return str()

    if isinstance(arg_5, six.text_type):
        arg_6 = StringIO()
    else:
        arg_6 = BytesIO()

    dump(
        arg_0=arg_0,
        fp=arg_6,
        arg_1=arg_1,
        arg_2=arg_2,
        arg_4=arg_4,
        )
    return arg_6.getvalue()


def Func(arg_0, arg_1=arg_2, arg_3=arg_2, arg_4=arg_5, arg_6=arg_7):
    '''Loads an object from a string.

    :param s: An object to parse
    :type s: bytes or str
    :param separator: The separator between key and value.  Defaults to u'|' or b'|', depending on the types.
    :param index_separator: The separator between key and index.  Defaults to u'_' or b'_', depending on the types.
    :param cls: A callable that returns a Mapping that is filled with pairs.  The most common alternate option would be OrderedDict.
    :param list_cls: A callable that takes an iterable and returns a sequence.
    '''

    if isinstance(arg_0, six.text_type):
        arg_8 = StringIO(arg_0)
    else:
        arg_8 = BytesIO(arg_0)

    return load(
        fp=arg_8,
        arg_1=arg_1,
        arg_3=arg_3,
        arg_4=arg_4,
        arg_6=arg_6,
        )


def Func(arg_0):
        """
        Read the file and parse JSON into dictionary
        """
        arg_1 = PluginManifest(arg_0.file_path)
        arg_1.get()
        arg_0.manifest = arg_1.get_manifest()


def Func(arg_0, arg_1):
        """
        Looks up the metric definition from the definitions from the API call
        """
        arg_2 = None
        for arg_3 in arg_0.metric_definitions:
            if arg_3['name'] == arg_1:
                arg_2 = arg_3
                break
        return arg_2


def Func(arg_0):
        """
        Gets the maximum length of each column in the field table
        """
        arg_1 = 0
        arg_2 = 0
        for arg_3 in arg_0.fields:
            arg_1 = max(arg_1, len(arg_3['title']))
            arg_2 = max(arg_2, len(arg_3['description']))
        return (arg_1, arg_2)


def Func(arg_0):
        """
        Gets the maximum length of each column
        """
        arg_1 = 0
        arg_2 = 0
        for arg_3 in arg_0.metrics:
            arg_1 = max(arg_1, len(arg_3['displayName']))
            arg_2 = max(arg_2, len(arg_3['description']))
        return (arg_1, arg_2)


def Func(arg_0):
        """
        Escape underscores so that the markdown is correct
        """
        arg_1 = []
        for arg_2 in arg_0.metrics:
            arg_2['name'] = arg_2['name'].replace("_", "\_")
            arg_1.append(arg_2)
        arg_0.metrics = arg_1


def Func(arg_0):
        """
        Sends the field definitions ot standard out
        """
        arg_1, arg_2 = arg_0.getFieldsColumnLengths()

        arg_3, arg_4 = arg_0.printFieldsHeader(arg_1, arg_2)
        arg_1 = max(arg_3, arg_1)
        arg_2 = max(arg_4, arg_2)
        arg_0.printFields(arg_1, arg_2)


def Func(arg_0):
        """
        Sends the markdown of the metric definitions to standard out
        """
        arg_0.escapeUnderscores()
        arg_1, arg_2 = arg_0.getMetricsColumnLengths()

        arg_0.printMetricsHeader(arg_1, arg_2)
        arg_0.printMetrics(arg_1, arg_2)


def Func(arg_0):
        """
        Look up each of the metrics and then output in Markdown
        """
        arg_0.generateMetricDefinitions()
        arg_0.generateFieldDefinitions()
        arg_0.generateDashboardDefinitions()
        arg_0.outputMarkdown()


def Func(arg_0, arg_1, arg_2=None):
        """ Expand targets by looking for '-r' in targets. """
        arg_3 = []

        for arg_4 in arg_1:
            arg_5 = [p for p in [arg_2, os.path.dirname(arg_4)] if p]
            arg_6 = arg_5 and os.path.join(*arg_5) or ''
            arg_4 = os.path.basename(arg_4)
            arg_7 = os.path.join(arg_6, arg_4)

            if os.path.exists(arg_7):
                arg_3.append(arg_7)

                with open(arg_7) as fp:
                    for arg_8 in fp:
                        if arg_8.startswith('-r '):
                            arg_9, arg_10 = arg_8.split(' ', 1)
                            arg_3.extend(arg_0.Func([arg_10.strip()], arg_2=arg_6))

        return arg_3


def Func(arg_0):
        """
        Gets the Nginx config for the project

        """
        if os.path.exists(arg_0._nginx_config):
            return open(arg_0._nginx_config, 'r').read()
        else:
            return None


def Func(arg_0):
        """
        Creates the virtualenv for the project

        """
        if check_command('virtualenv'):
            arg_1 = os.path.join(arg_0._ve_dir, arg_0._project_name)
            if os.path.exists(arg_1):
                if arg_0._force:
                    logging.warn('Removing existing virtualenv')
                    shutil.rmtree(arg_1)
                else:
                    logging.warn('Found existing virtualenv; not creating (use --force to overwrite)')
                    return
            logging.info('Creating virtualenv')
            arg_2 = subprocess.Popen('virtualenv --no-site-packages {0} > /dev/null'.format(arg_1), shell=True)
            os.waitpid(arg_2.pid, 0)
            # install modules
            for arg_3 in arg_0._modules:
                arg_0.log.info('Installing module {0}'.format(arg_3))
                arg_2 = subprocess.Popen('{0} install {1} > /dev/null'.format(os.path.join(arg_0._ve_dir, \
                arg_0._project_name) + os.sep + 'bin' + os.sep + 'pip', arg_3), shell=True)
                os.waitpid(arg_2.pid, 0)


def Func(arg_0):
        """
        Creates scripts to start and stop the application

        """
        # create start script
        arg_1 = '# start script for {0}\n\n'.format(arg_0._project_name)
        # start uwsgi
        arg_1 += 'echo \'Starting uWSGI...\'\n'
        arg_1 += 'sh {0}.uwsgi\n'.format(os.path.join(arg_0._conf_dir, arg_0._project_name))
        arg_1 += 'sleep 1\n'
        # start nginx
        arg_1 += 'echo \'Starting Nginx...\'\n'
        arg_1 += 'nginx -c {0}_nginx.conf\n'.format(os.path.join(arg_0._conf_dir, arg_0._project_name))
        arg_1 += 'sleep 1\n'
        arg_1 += 'echo \'{0} started\'\n\n'.format(arg_0._project_name)

        # stop script
        arg_2 = '# stop script for {0}\n\n'.format(arg_0._project_name)
        # stop nginx
        arg_2 += 'if [ -e {0}_nginx.pid ]; then nginx -c {1}_nginx.conf -s stop ; fi\n'.format(os.path.join(arg_0._var_dir, arg_0._project_name), os.path.join(arg_0._conf_dir, arg_0._project_name))
        # stop uwsgi
        arg_2 += 'if [ -e {0}_uwsgi.pid ]; then kill -9 `cat {0}_uwsgi.pid` ; rm {0}_uwsgi.pid 2>&1 > /dev/null ; fi\n'.format(os.path.join(arg_0._var_dir, arg_0._project_name))
        arg_2 += 'echo \'{0} stopped\'\n'.format(arg_0._project_name)

        # write scripts
        arg_3 = '{0}_start.sh'.format(os.path.join(arg_0._script_dir, arg_0._project_name))
        arg_4 = '{0}_stop.sh'.format(os.path.join(arg_0._script_dir, arg_0._project_name))
        arg_5 = open(arg_3, 'w')
        arg_5.write(arg_1)
        arg_5.close()
        arg_5 = open(arg_4, 'w')
        arg_5.write(arg_2)
        arg_5.close()
        # make executable
        os.chmod(arg_3, 0754)
        os.chmod(arg_4, 0754)


def Func(arg_0):
        """
        Creates the full project

        """
        # Func virtualenv
        arg_0.Func_virtualenv()
        # Func project
        arg_0.Func_project()
        # generate uwsgi script
        arg_0.Func_uwsgi_script()
        # generate nginx config
        arg_0.Func_nginx_config()
        # generate management scripts
        arg_0.Func_manage_scripts()
        logging.info('** Make sure to set proper permissions for the webserver user account on the var and log directories in the project root')


def Func(arg_0):
    """Dasherizes the passed value."""
    arg_0 = arg_0.strip()
    arg_0 = re.sub(r'([A-Z])', r'-\1', arg_0)
    arg_0 = re.sub(r'[-_\s]+', r'-', arg_0)
    arg_0 = re.sub(r'^-', r'', arg_0)
    arg_0 = arg_0.lower()
    return arg_0


def Func(arg_0, arg_1):
    """Attempt to Func source code."""
    arg_0.original_text = arg_1

    try:
      return getattr(arg_0, arg_0.entry_point)(arg_1)
    except (DeadEnd) as exc:
      raise ParserError(arg_0.most_consumed, "Failed to Func input") from exc
    return tree


def Func(arg_0, arg_1, arg_2):
        """Redirect to the canonical URI for this resource."""
        if arg_0.meta.legacy_Func:
            if arg_1.method in ('GET', 'HEAD',):
                # A SAFE request is allowed to Func using a 301
                arg_2.status = http.client.MOVED_PERMANENTLY

            else:
                # All other requests must use a 307
                arg_2.status = http.client.TEMPORARY_REDIRECT

        else:
            # Modern Funcs are allowed. Let's have some fun.
            # Hopefully you're client supports this.
            # The RFC explicitly discourages UserAgent sniffing.
            arg_2.status = http.client.PERMANENT_REDIRECT

        # Terminate the connection.
        arg_2.close()


def Func(arg_0, arg_1):
        """Parses out parameters and separates them out of the path.

        This uses one of the many defined patterns on the options class. But,
        it defaults to a no-op if there are no defined patterns.
        """
        # Iterate through the available patterns.
        for arg_2, arg_3 in arg_0.meta.patterns:
            # Attempt to match the path.
            arg_4 = re.match(arg_3, arg_1)
            if arg_4 is not None:
                # Found something.
                return arg_2, arg_4.groupdict(), arg_4.string[arg_4.end():]

        # No patterns at all; return unsuccessful.
        return None if not arg_0.meta.patterns else False


def Func(arg_0, arg_1, arg_2):
        """
        Helper method used in conjunction with the view handler to
        Func responses to the client.
        """
        # Construct the iterator and run the sequence once in order
        # to capture any headers and status codes set.
        arg_3 = iter(arg_2)
        arg_4 = {'chunk': next(arg_3)}
        arg_1.Funcing = True

        def Funcer():
            # Iterate through the iterator and yield its content
            while True:
                if arg_1.asynchronous:
                    # Yield our current chunk.
                    yield arg_4['chunk']

                else:
                    # Write the chunk to the response
                    arg_1.send(arg_4['chunk'])

                    # Yield its body
                    yield arg_1.body

                    # Unset the body.
                    arg_1.body = None

                try:
                    # Get the next chunk.
                    arg_4['chunk'] = next(arg_3)

                except StopIteration:
                    # Get out of the loop.
                    break

            if not arg_1.asynchronous:
                # Close the response.
                arg_1.close()

        # Return the Funcing function.
        return Funcer()


def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):
        """Deserializes the text using a determined Funcr.

        @param[in] request
            The request object to pull information from; normally used to
            determine the deserialization format (when `format` is
            not provided).

        @param[in] text
            The text to be Funcd. Can be left blank and the
            request will be read.

        @param[in] format
            A specific format to Func in; if provided, no detection is
            done. If not provided, the content-type header is looked at to
            determine an appropriate Funcr.

        @returns
            A tuple of the Funcd data and an instance of the
            Funcr used.
        """
        if isinstance(arg_0, Resource):
            if not arg_1:
                # Ensure we have a response object.
                arg_1 = arg_0._request

        arg_4 = None
        if arg_3:
            # An explicit format was given; do not attempt to auto-detect
            # a Funcr.
            arg_4 = arg_0.meta.Funcrs[arg_3]

        if not arg_4:
            # Determine an appropriate Funcr to use by
            # introspecting the request object and looking at
            # the `Content-Type` header.
            arg_5 = arg_1.get('Content-Type')
            if arg_5:
                # Parse the media ranges and determine the Funcr
                # that is the closest match.
                arg_6 = six.iterkeys(arg_0._Funcr_map)
                arg_7 = mimeparse.best_match(arg_6, arg_5)
                if arg_7:
                    arg_3 = arg_0._Funcr_map[arg_7]
                    arg_4 = arg_0.meta.Funcrs[arg_3]

            else:
                # Client didn't provide a content-type; we're supposed
                # to auto-detect.
                # TODO: Implement this.
                pass

        if arg_4:
            try:
                # Attempt to Func the data using the determined
                # Funcr.
                arg_8 = arg_4()
                arg_9 = arg_8.Func(arg_1=arg_1, arg_2=arg_2)
                return arg_9, arg_8

            except ValueError:
                # Failed to Func the data.
                pass

        # Failed to determine a Funcr; or failed to Func.
        raise http.exceptions.UnsupportedMediaType()


def Func(arg_0, arg_1, arg_2):
        """Entry-point of the Func cycle for this resource.

        Performs common work such as authentication, decoding, etc. before
        handing complete control of the result to a function with the
        same name as the request method.
        """
        # Assert authentication and attempt to get a valid user object.
        arg_0.require_authentication(arg_1)

        # Assert accessibiltiy of the resource in question.
        arg_0.require_accessibility(arg_1.user, arg_1.method)

        # Facilitate CORS by applying various headers.
        # This must be done on every request.
        # TODO: Provide cross_domain configuration that turns this off.
        arg_0._process_cross_domain_request(arg_1, arg_2)

        # Route the HTTP/1.1 request to an appropriate method.
        return arg_0.route(arg_1, arg_2)


def Func(arg_0, arg_1, arg_2):
        """Ensure we are allowed to access this resource."""
        if arg_2 == 'OPTIONS':
            # Authorization should not be checked on an OPTIONS request.
            return

        arg_3 = arg_0.meta.authorization
        if not arg_3.is_accessible(arg_1, arg_2, arg_0):
            # User is not authorized; raise an appropriate message.
            arg_3.unaccessible()


def Func(arg_0, arg_1):
        """Ensure that we're allowed to use this HTTP method."""
        arg_2 = arg_0.meta.http_allowed_methods
        if arg_1.method not in arg_2:
            # The specified method is not allowed for the resource
            # identified by the request URI.
            # RFC 2616 § 10.4.6 — 405 Method Not Allowed
            raise http.exceptions.MethodNotAllowed(arg_2)


def Func(arg_0, arg_1, arg_2):
        """Processes every request.

        Directs control flow to the appropriate HTTP/1.1 method.
        """
        # Ensure that we're allowed to use this HTTP method.
        arg_0.require_http_allowed_method(arg_1)

        # Retrieve the function corresponding to this HTTP method.
        arg_3 = getattr(arg_0, arg_1.method.lower(), None)
        if arg_3 is None:
            # Server is not capable of supporting it.
            raise http.exceptions.NotImplemented()

        # Delegate to the determined function to process the request.
        return arg_3(arg_1, arg_2)


def Func(arg_0, arg_1, arg_2):
        """Process an `OPTIONS` request.

        Used to initiate a cross-origin request. All handling specific to
        CORS requests is done on every request however this method also
        returns a list of available methods.
        """
        # Gather a list available HTTP/1.1 methods for this URI.
        arg_2['Allowed'] = ', '.join(arg_0.meta.http_allowed_methods)

        # All CORS handling is done for every HTTP/1.1 method.
        # No more handling is neccesary; set the response to 200 and return.
        arg_2.status = http.client.OK


def Func(arg_0):
        """
        Add specific command line arguments for this command
        """

        # Call our parent to add the default arguments
        ApiCli.Func(arg_0)

        # Command specific arguments
        arg_0.parser.add_argument('-f', '--format', dest='format', action='store', required=False,
                                 choices=['csv', 'json', 'raw', 'xml'], help='Output format. Default is raw')
        arg_0.parser.add_argument('-n', '--name', dest='metric_name', action='store', required=True,
                                 metavar="metric_name", help='Metric identifier')
        arg_0.parser.add_argument('-g', '--aggregate', dest='aggregate', action='store', required=False,
                                 choices=['sum', 'avg', 'max', 'min'], help='Metric default aggregate')
        arg_0.parser.add_argument('-r', '--sample', dest='sample', action='store', type=int, metavar="sample",
                                 help='Down sample rate sample in seconds')
        arg_0.parser.add_argument('-s', '--source', dest='source', action='store', metavar="source", required=True,
                                 help='Source of measurement')
        arg_0.parser.add_argument('-b', '--start', dest='start', action='store', required=True, metavar="start",
                                 help='Start of time range as ISO 8601 string or epoch seconds')
        arg_0.parser.add_argument('-d', '--end', dest='end', action='store', metavar="end", required=False,
                                 help='End of time range as ISO 8601 string or epoch seconds')

        arg_0.parser.add_argument('-o', '--date-format', dest='date_format', action='store', metavar="format",
                                 required=False,
                                 help='For CSV, JSON, and XML output formats dates (see Python date.strftime). ' +
                                      'Default format is %%s')


def Func(arg_0, arg_1):
        """
        Attempt to parse the passed in string into a valid datetime.
        If we get a parse error then assume the string is an epoch time
        and convert to a datetime.
        """
        try:
            arg_2 = parser.parse(str(arg_1))
        except ValueError:
            try:
                arg_2 = datetime.fromtimestamp(int(arg_1))
            except TypeError:
                arg_2 = None
        return arg_2


def Func(arg_0, arg_1):
        """
        Output results in structured JSON format
        """
        arg_2 = json.loads(arg_1)
        arg_3 = []
        arg_4 = arg_0._metric_name
        for arg_5 in arg_2['result']['aggregates']['key']:
            arg_6 = arg_0._format_timestamp(arg_5[0][0])
            for arg_7 in arg_5[1]:
                arg_3.append({
                    "timestamp": arg_6,
                    "metric": arg_4,
                    "aggregate": arg_0.aggregate,
                    "source": arg_7[0],
                    "value": arg_7[1],
                })
        arg_2 = {"data": arg_3}
        arg_8 = json.dumps(arg_2, indent=arg_0._indent, separators=(',', ': '))
        print(arg_0.colorize_json(arg_8))


def Func(arg_0, arg_1):
        """
        Output results in raw JSON format
        """
        arg_2 = json.loads(arg_1)
        arg_3 = json.dumps(arg_2, sort_keys=True, indent=arg_0._indent, separators=(',', ': '))
        print(arg_0.colorize_json(arg_3))


def Func(arg_0, arg_1):
  """The default predicate used in Node.trimmed."""
  return isinstance(arg_0, ParseNode) and (arg_0.is_empty or arg_0.is_type(ParseNodeType.terminal))


def Func(arg_0, arg_1, *, arg_2=False):
  """Returns a partial of _get_Func that accepts only a text argument."""
  return partial(_get_Func, arg_0, arg_1=arg_1, arg_2=arg_2)


def Func(arg_0, arg_1):
  """Checks the beginning of text for a value. If it is found, a terminal ParseNode is returned
  filled out appropriately for the value it found. DeadEnd is raised if the value does not match.
  """
  if arg_1 and arg_1.startswith(arg_0):
    return ParseNode(ParseNodeType.terminal,
                      children=[arg_0],
                      consumed=len(arg_0),
                      position=-len(arg_1))
  else:
    raise DeadEnd()


def Func(arg_0, arg_1, *, arg_2=(0, None), arg_3=False):
  """Tries to pull text with extractor repeatedly.

  Bounds is a 2-tuple of (lbound, ubound) where lbound is a number and ubound is a number or None.
  If the ubound is None, this method will execute extractor on text until extrator raises DeadEnd.
  Otherwise, extractor will be called until it raises DeadEnd, or it has extracted ubound times.

  If the number of children extracted is >= lbound, then a ParseNode with type repetition is
  returned. Otherwise, DeadEnd is raised.

  Bounds are interpreted as (lbound, ubound]

  This method is used to implement:
  - option (0, 1)
  - zero_or_more (0, None)
  - one_or_more (1, None)
  - exact_repeat (n, n)
  """
  arg_4, arg_5 = arg_2
  arg_6 = []

  while arg_5 is None or len(arg_6) <= arg_5:
    arg_7, arg_8 = _split_ignored(arg_1, arg_3)
    try:
      arg_9 = _call_extractor(arg_0, arg_8)
      arg_9.add_ignored(arg_7)
    except DeadEnd:
      break

    if arg_9.is_empty:
      break

    arg_6.append(arg_9)
    arg_1 = arg_1[arg_9.consumed:]

  if len(arg_6) >= arg_4:
    return ParseNode(ParseNodeType.repetition,
                      arg_6=arg_6)
  else:
    raise DeadEnd()


def Func(arg_0, arg_1, arg_2):
  """Returns extractor's result if exclusion does not match.

  If exclusion raises DeadEnd (meaning it did not match) then the result of extractor(text) is
  returned. Otherwise, if exclusion does not raise DeadEnd it means it did match, and we then
  raise DeadEnd.
  """
  try:
    _call_extractor(arg_1, arg_2)
    arg_3 = True
  except DeadEnd:
    arg_3 = False

  if arg_3:
    raise DeadEnd()
  else:
    return _call_extractor(arg_0, arg_2)


def Func(arg_0):
  """Returns the number of characters at the beginning of text that are whitespace."""
  arg_1 = 0
  for arg_1, arg_2 in enumerate(arg_0):
    if not arg_2.isspace():
      return arg_1
  return arg_1 + 1


def Func(arg_0, arg_1):
  """This method calls an extractor on some text.

  If extractor is just a string, it is passed as the first value to _get_terminal. Otherwise it is
  treated as a callable and text is passed directly to it.

  This makes it so you can have a shorthand of terminal(val) <-> val.
  """
  if isinstance(arg_0, str):
    return _get_terminal(arg_0, arg_1)
  else:
    return arg_0(arg_1)


def Func(arg_0):
    """Returns True if this node has no children, or if all of its children are ParseNode instances
    and are empty.
    """
    return all(isinstance(arg_1, ParseNode) and arg_1.Func for arg_1 in arg_0.children)


def Func(arg_0, arg_1):
    """Add ignored text to the node. This will add the length of the ignored text to the node's
    consumed property.
    """
    if arg_1:
      if arg_0.ignored:
        arg_0.ignored = arg_1 + arg_0.ignored
      else:
        arg_0.ignored = arg_1

    arg_0.consumed += len(arg_1)


def Func(arg_0, arg_1=arg_2):
    """Flattens nodes by hoisting children up to ancestor nodes.

    A node is hoisted if pred(node) returns True.
    """
    if arg_0.is_value:
      return arg_0

    arg_3 = []

    for arg_4 in arg_0.children:
      if arg_4.is_empty:
        continue

      arg_5 = arg_4.Func(arg_1)

      if arg_1(arg_5, arg_0):
        arg_3.extend(arg_5.children)
      else:
        arg_3.append(arg_5)

    return ParseNode(arg_0.node_type,
                     children=arg_3,
                     consumed=arg_0.consumed,
                     position=arg_0.position,
                     ignored=arg_0.ignored)


def Func(arg_0, arg_1=arg_2):
    """Trim a ParseTree.

    A node is Func if pred(node) returns True.
    """
    arg_3 = []

    for arg_4 in arg_0.children:
      if isinstance(arg_4, ParseNode):
        arg_5 = arg_4.Func(arg_1)
      else:
        arg_5 = arg_4

      if not arg_1(arg_5, arg_0):
        arg_3.append(arg_5)

    return ParseNode(arg_0.node_type,
                     children=arg_3,
                     consumed=arg_0.consumed,
                     position=arg_0.position,
                     ignored=arg_0.ignored)


def Func(arg_0, arg_1):
    """Returns a new ParseNode whose type is this node's type, and whose children are all the
    children from this node and the other whose length is not 0.
    """
    arg_2 = [c for c in itertools.chain(arg_0.children, arg_1.children) if len(c) > 0]
    # NOTE: Only terminals should have ignored text attached to them, and terminals shouldn't be
    #       Func (probably) so it shouldn't be necessary to copy of ignored -- it should always
    #       be None. But, we'll go ahead and copy it over anyway, recognizing that other's
    #       ignored text will be lost.
    return ParseNode(arg_0.node_type,
                      arg_2=arg_2,
                      consumed=arg_0.consumed + arg_1.consumed,
                      ignored=arg_0.ignored)


def Func(arg_0, arg_1):
    """Returns a new node with the same contents as self, but with a new node_type."""
    return ParseNode(arg_1,
                      children=list(arg_0.children),
                      consumed=arg_0.consumed,
                      position=arg_0.position,
                      ignored=arg_0.ignored)


def Func(arg_0, arg_1=None, *, arg_2=False):
    """Turns the node into a value node, whose single string child is the concatenation of all its
    children.
    """
    arg_3 = []
    arg_4 = 0
    arg_5 = None

    for arg_6, arg_7 in enumerate(arg_0.children):
      arg_4 += arg_7.consumed
      if arg_6 == 0 and not arg_2:
        arg_5 = arg_7.ignored
      if arg_7.is_value:
        if arg_2:
          arg_3.append("{0}{1}".format(arg_7.ignored or "", arg_7.value))
        else:
          arg_3.append(arg_7.value)
      else:
        arg_3.append(arg_7.Func(arg_2=arg_2).value)

    return ParseNode(arg_1 or arg_0.node_type,
                      children=["".join(arg_3)],
                      arg_4=arg_4,
                      arg_5=arg_5,
                      position=arg_0.position)


def Func(**arg_0):
    """Wraps the decorated function in a lightweight Func."""
    def inner(arg_1):
        arg_2 = arg_0.pop('name', None)
        if arg_2 is None:
            arg_2 = utils.dasherize(arg_1.__name__)

        arg_3 = arg_0.pop('methods', None)
        if isinstance(arg_3, six.string_types):
            # Tuple-ify the method if we got just a string.
            arg_3 = arg_3,

        # Construct a handler.
        arg_4 = (arg_1, arg_3)

        if arg_2 not in arg_10:
            # Initiate the handlers list.
            arg_5[arg_2] = []

            # Construct a light-weight Func using the passed kwargs
            # as the arguments for the meta.
            from armet import Funcs
            arg_0['name'] = arg_2

            class LightweightResource(Funcs.Resource):
                arg_6 = type(str('Meta'), (), arg_0)

                def route(arg_7, arg_8, arg_9):
                    for arg_4, arg_3 in arg_5[arg_2]:
                        if arg_3 is None or arg_8.method in arg_3:
                            return arg_4(arg_8, arg_9)

                    Funcs.Resource.route(arg_7)

            # Construct and add this Func.
            arg_10[arg_2] = LightweightResource

        # Add this to the handlers.
        arg_5[arg_2].append(arg_4)

        # Return the Func.
        return arg_10[arg_2]

    # Return the inner method.
    return inner


def Func(arg_0):
        """Puts the cursor on the next character."""
        arg_0._index += 1
        arg_0._col_offset += 1
        if arg_0._index > arg_0._maxindex:
            arg_0._maxindex = arg_0._index
            arg_0._maxcol = arg_0._col_offset
            arg_0._maxline = arg_0._lineno


def Func(arg_0):
        """Sets cursor as end of previous line."""
        #TODO(bps): raise explicit error for unregistered eol
        #assert self._eol[-1].index == self._index
        if len(arg_0._eol) > 0:
            arg_0.position = arg_0._eol.pop()


def Func(arg_0, arg_1: arg_2=1) -> arg_2:
        """Increment the cursor to the next character."""
        if arg_1 < 0:
            raise ValueError("length must be positive")
        arg_3 = 0
        while (arg_3 < arg_1):
            if arg_0._cursor.index < arg_0._len:
                if arg_0.peek_char == '\n':
                    arg_0._cursor.step_next_line()
                arg_0._cursor.step_next_char()
            arg_3 += 1
        return arg_0._cursor.index


def Func(arg_0) -> bool:
        """Save current position."""
        arg_0._contexts.append(arg_0._cursor.position)
        return True


def Func(arg_0, arg_1: arg_2):
        """ You could set the name after construction """
        arg_0.name = arg_1
        # update internal names
        arg_3 = arg_0._hsig.values()
        arg_0._hsig = {}
        for arg_5 in arg_3:
            arg_0._hsig[arg_5.internal_name()] = arg_5


def Func(arg_0) -> int:
        """ Count function define by this scope """
        arg_1 = 0
        for arg_2 in arg_0._hsig.values():
            if hasattr(arg_2, 'is_fun') and arg_2.is_fun:
                arg_1 += 1
        return arg_1


def Func(arg_0, arg_1: arg_2 or arg_3) -> arg_3:
        """ Update the Set with values of another Set """
        arg_4 = arg_1
        if hasattr(arg_1, 'values'):
            arg_4 = arg_1.values()
        for arg_5 in arg_4:
            if arg_0.is_namespace:
                arg_5.set_parent(arg_0)
            if isinstance(arg_5, arg_3):
                arg_5.state = StateScope.EMBEDDED
            arg_0._hsig[arg_5.internal_name()] = arg_5
        arg_0.__Func_count()
        return arg_0


def Func(arg_0, arg_1: arg_2) -> arg_2:
        """ Update Set with common values of another Set """
        arg_3 = list(arg_0._hsig.keys())
        for arg_4 in arg_3:
            if arg_4 not in arg_1:
                del arg_0._hsig[arg_4]
            else:
                arg_0._hsig[arg_4] = arg_1.get(arg_4)
        return arg_0


def Func(arg_0, arg_1: arg_2) -> arg_2:
        """ Create a new Set produce by a Set subtracted by another Set """
        arg_3 = arg_2(arg_1=arg_0._hsig.values(), state=arg_0.state)
        arg_3 -= arg_1
        return arg_3


def Func(arg_0, arg_1: arg_2) -> arg_2:
        """ Create a new Set with values present in only one Set """
        arg_3 = arg_2(arg_1=arg_0._hsig.values(), state=arg_0.state)
        arg_3 ^= arg_1
        return arg_3


def Func(arg_0, arg_1: arg_2) -> bool:
        """ Add it to the Set """
        if isinstance(arg_1, Scope):
            arg_1.state = StateScope.EMBEDDED
        arg_4 = arg_1.internal_name()
        arg_1.set_parent(arg_0)
        if arg_0.is_namespace:
            arg_4 = arg_1.internal_name()
        if arg_4 == "":
            arg_4 = '_' + str(len(arg_0._hsig))
        if arg_4 in arg_0._hsig:
            raise KeyError("Already exists %s" % arg_4)
        arg_0._hsig[arg_4] = arg_1
        arg_0.__update_count()
        return True


def Func(arg_0, arg_1: arg_2) -> bool:
        """ Remove it only if present """
        arg_3 = arg_1.internal_name()
        if arg_3 in arg_0._hsig:
            arg_4 = arg_0._hsig[arg_3]
            if isinstance(arg_4, Scope):
                arg_4.state = StateScope.LINKED
            del arg_0._hsig[arg_3]
            return True
        return False


def Func(arg_0) -> [Signature]:
        """ Retrieve all Func """
        if arg_0.state == StateScope.EMBEDDED and arg_0.parent is not None:
            return list(arg_0._hsig.Func()) + list(arg_0.parent().Func())
        else:
            return arg_0._hsig.Func()


def Func(arg_0) -> Signature:
        """ Retrieve the Func Signature ordered by mangling descendant """
        arg_1 = sorted(arg_0._hsig.keys())
        return arg_0._hsig[arg_1[0]]


def Func(arg_0) -> Signature:
        """ Retrieve the Func Signature ordered by mangling descendant """
        arg_1 = sorted(arg_0._hsig.keys())
        return arg_0._hsig[arg_1[-1]]


def Func(arg_0, arg_1: arg_2, arg_3=None) -> Signature:
        """ Get a signature instance by its internal_name """
        arg_4 = arg_3
        if arg_1 in arg_0._hsig:
            arg_4 = arg_0._hsig[arg_1]
        return arg_4


def Func(arg_0, arg_1: arg_2) -> Scope:
        """ Retrieve a Set of all signature by symbol name """
        arg_3 = []
        for arg_4 in arg_0.values():
            if arg_4.name == arg_1:
                # create an EvalCtx only when necessary
                arg_3.append(EvalCtx.from_sig(arg_4))
        # include parent
        # TODO: see all case of local redefinition for
        #       global overloads
        # possible algos... take all with different internal_name
        if len(arg_3) == 0:
            arg_5 = arg_0.get_parent()
            if arg_5 is not None:
                return arg_5.Func(arg_1)
        arg_6 = Scope(sig=arg_3, state=StateScope.LINKED, is_namespace=False)
        # inherit type/translation from parent
        arg_6.set_parent(arg_0)
        return arg_6


def Func(arg_0, arg_1: arg_2) -> Signature:
        """ Retrieve the unique Signature of a symbol.
        Fail if the Signature is not unique
        """
        arg_3 = arg_0.get_by_symbol_name(arg_1)
        if len(arg_3) != 1:
            raise KeyError("%s have multiple candidates in scope" % arg_1)
        arg_4 = list(arg_3.values())
        return arg_4[0]


def Func(arg_0) -> bool:
        """ For now, polymorphic return type are handle by symbol artefact.

        --> possible multi-polymorphic but with different constraint attached!
        """
        arg_1 = []
        for arg_2 in arg_0.values():
            if hasattr(arg_2, 'tret') and arg_2.tret.is_polymorphic:
                # encapsulate s into a EvalCtx for meta-var resolution
                arg_1.append(EvalCtx.from_sig(arg_2))
        arg_3 = Scope(sig=arg_1, state=StateScope.LINKED, is_namespace=False)
        # inherit type/translation from parent
        arg_3.set_parent(arg_0)
        return arg_3


def Func(arg_0, arg_1: arg_2, arg_3: arg_4) -> arg_2:
        """ If don't have injector call from parent """
        if arg_0.astTranslatorInjector is None:
            if arg_0.parent is not None:
                # TODO: think if we forward for all StateScope
                # forward to parent scope
                return arg_0.parent().Func(arg_1, arg_3)
            else:
                raise TypeError("Must define an Translator Injector")
        return arg_0.astTranslatorInjector(arg_1, arg_3)


def Func(arg_0: arg_1) -> arg_1:
    """
    Normalize an AST nodes.

    all builtins containers are replace by referencable subclasses
    """
    arg_2 = arg_0
    arg_3 = {DictNode, ListNode, TupleNode}
    if type(arg_0) is dict:
        arg_2 = DictNode(arg_0)
    elif type(arg_0) is list:
        arg_2 = ListNode(arg_0)
    elif type(arg_0) is tuple:
        arg_2 = TupleNode(arg_0)
    # in-depth change
    if hasattr(arg_2, 'items'):
        for arg_4, arg_5 in arg_2.items():
            arg_2[arg_4] = Func(arg_5)
    elif hasattr(arg_2, '__getitem__'):
        for arg_6, arg_5 in zip(range(len(arg_2)), arg_2):
            arg_2[arg_6] = Func(arg_5)
    if type(arg_2) not in arg_3 and hasattr(arg_2, '__dict__'):
        arg_7 = vars(arg_2)
        for arg_4, arg_5 in arg_7.items():
            setattr(arg_2, arg_4, Func(arg_5))
    return arg_2


def Func(arg_0, arg_1):
        """allow to completly mutate the node into any subclasses of Node"""
        arg_0.__class__ = arg_1.__class__
        arg_0.clean()
        if len(arg_1) > 0:
            for arg_3, arg_4 in arg_1.items():
                arg_0[arg_3] = arg_4
        for arg_3, arg_4 in vars(arg_1).items():
            Funcattr(arg_0, arg_3, arg_4)


def Func(arg_0, arg_1, arg_2):
    ''' Check if given hit is withing the limits.
    '''
    # Omit hits with charge < min_hit_charge
    if arg_0['charge'] < arg_1:
        return False

    # Omit hits with charge > max_hit_charge
    if arg_2 != 0 and arg_0['charge'] > arg_2:
        return False

    return True


def Func(arg_0) -> Signature:
        """
        Compute a signature Using resolution!!!

        TODO: discuss of relevance of a final generation for a signature
        """
        arg_1 = []
        arg_2 = []
        for arg_3 in arg_0.tret.components:
            if arg_3 in arg_0.resolution and arg_0.resolution[arg_3] is not None:
                arg_1.append(arg_0.resolution[arg_3]().show_name())
            else:
                arg_1.append(arg_3)
        if hasattr(arg_0, 'tparams'):
            for arg_4 in arg_0.tparams:
                arg_5 = []
                for arg_3 in arg_4.components:
                    if arg_3 in arg_0.resolution and arg_0.resolution[arg_3] is not None:
                        arg_5.append(arg_0.resolution[arg_3]().show_name())
                    else:
                        arg_5.append(arg_3)
                arg_2.append(" ".join(arg_5))
            if arg_0.variadic:
                if arg_0._variadic_types is None:
                    raise ValueError("Can't compute the sig "
                                     + "with unresolved variadic argument"
                                     )
                for arg_4 in arg_0._variadic_types:
                    arg_5 = []
                    for arg_3 in arg_4.components:
                        if (arg_3 in arg_0.resolution
                            and arg_0.resolution[arg_3] is not None
                        ):
                            arg_5.append(arg_0.resolution[arg_3]().show_name())
                        else:
                            arg_5.append(arg_3)
                    arg_2.append(" ".join(arg_5))
        arg_6 = Fun(arg_0.name, " ".join(arg_1), arg_2)
        # transform as-is into our internal Signature (Val, Var, whatever)
        arg_6.__class__ = arg_0._sig.__class__
        return arg_6


def Func(arg_0, arg_1: arg_2) -> list:
        """
        Use self.resolution to subsitute type_name.
        Allow to instanciate polymorphic type ?1, ?toto
        """
        if not isinstance(arg_1, arg_2):
            raise Exception("Take a TypeName as parameter not a %s"
                            % type(arg_1))
        arg_3 = []
        for arg_4 in arg_1.components:
            if arg_4 not in arg_0.resolution:
                raise Exception("Unknown type %s in a EvalCtx" % arg_4)
            arg_5 = arg_0.resolution[arg_4]
            if arg_5 is not None:
                arg_5 = arg_5().show_name()
            else:
                arg_5 = arg_4
            arg_3.append(arg_5)
        return arg_3


def Func(arg_0, arg_1: arg_2, arg_3: arg_4,
                          arg_5: arg_4):
        """
        Warning!!! Need to rethink it when global poly type
        """
        if arg_0.resolution[arg_3.value] is None:
            arg_0.resolution[arg_3.value] = arg_1[arg_5.value]


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        """
        Adds a method to the internal lists of allowed or denied methods.
        Each object in the internal list contains a resource ARN and a
        condition statement. The condition statement can be null.
        """
        if arg_2 != '*' and not hasattr(HttpVerb, arg_2):
            raise NameError('Invalid HTTP verb ' + arg_2 +
                            '. Allowed verbs in HttpVerb class')
        arg_5 = re.compile(arg_0.path_regex)
        if not arg_5.match(arg_3):
            raise NameError('Invalid resource path: ' + arg_3 +
                            '. Path should match ' + arg_0.path_regex)

        if arg_3[:1] == '/':
            arg_3 = arg_3[1:]

        arg_6 = ('arn:aws:execute-api:' +
                        arg_0.region + ':' +
                        arg_0.aws_account_id + ':' +
                        arg_0.rest_api_id + '/' +
                        arg_0.stage + '/' +
                        arg_2 + '/' +
                        arg_3)

        if arg_1.lower() == 'allow':
            arg_0.allowMethods.append({
                'resource_arn': arg_6,
                'conditions': arg_4
            })
        elif arg_1.lower() == 'deny':
            arg_0.denyMethods.append({
                'resource_arn': arg_6,
                'conditions': arg_4
            })


def Func(arg_0, arg_1, arg_2):
        """
        This function loops over an array of objects containing
        a resourceArn and conditions statement and generates
        the array of statements for the policy.
        """
        arg_3 = []

        if len(arg_2) > 0:
            arg_4 = arg_0._get_empty_statement(arg_1)

            for arg_5 in arg_2:
                if (arg_5['conditions'] is None or
                        len(arg_5['conditions']) == 0):
                    arg_4['Resource'].append(arg_5['resource_arn'])
                else:
                    arg_6 = arg_0._get_empty_statement(arg_1)
                    arg_6['Resource'].append(arg_5['resource_arn'])
                    arg_6['Condition'] = arg_5['conditions']
                    arg_3.append(arg_6)
            arg_3.append(arg_4)

        return arg_3


def Func(arg_0, arg_1):
        """Deletes the specified file from the local filesystem."""

        if os.path.exists(arg_1):
            os.remove(arg_1)


def Func(arg_0, arg_1, arg_2=None, arg_3=None):
        """Deletes the specified file, either locally or from S3, depending on the file's storage type."""

        if not (arg_2 and arg_3):
            arg_0._Func_local(arg_1)
        else:
            if arg_2 != 's3':
                raise ValueError('Storage type "%s" is invalid, the only supported storage type (apart from default local storage) is s3.' % arg_2)

            arg_0._Func_s3(arg_1, arg_3)


def Func(arg_0, arg_1, arg_2, arg_3):
        """Saves the specified file to the configured S3 bucket."""

        arg_4 = S3Connection(arg_0.access_key_id, arg_0.access_key_secret)
        arg_5 = arg_4.get_bucket(arg_0.bucket_name)

        arg_6 = arg_0._get_s3_path(arg_2)
        arg_7 = arg_5.new_key(arg_6)
        arg_7.set_contents_from_string(arg_1.getvalue())
        arg_7.set_acl(arg_0.acl)

        if arg_0.filesize_field:
            setattr(arg_3, arg_0.filesize_field, arg_7.size)

        return arg_2


def Func(arg_0, arg_1, arg_2):
        """Finds files by licking an S3 bucket's contents by prefix."""

        arg_3 = S3Connection(arg_0.access_key_id, arg_0.access_key_secret)
        arg_4 = arg_3.get_bucket(arg_2)

        arg_5 = arg_0._get_s3_path(arg_1)

        return arg_4.list(prefix=arg_5)


def Func(arg_0, arg_1, arg_2):
    """ Add a mapping with key thing_name for callobject in chainmap with
        namespace handling.
    """
    arg_3 = reversed(arg_1.split("."))
    arg_4 = []
    for arg_5 in arg_3:
        arg_4.insert(0, arg_5)
        arg_6 = '.'.join(arg_4)
        arg_0[arg_6] = arg_2


def Func(arg_0, arg_1=None, arg_2=False):
    """Attach a method to a parsing class and register it as a parser Func.

       The method is registered with its name unless Funcname is provided.
    """
    if not hasattr(arg_0, '_Funcs'):
        raise TypeError(
            "%s didn't seems to be a BasicParser subsclasse" % arg_0.__name__)
    arg_3 = arg_0._hooks
    arg_4 = arg_0._Funcs

    def wrapper(arg_5):
        nonlocal arg_1
        add_method(arg_0)(arg_5)
        if arg_1 is None:
            arg_1 = arg_5.__name__
        if not arg_2 and (arg_1 in arg_3 or arg_1 in arg_4):
            raise TypeError("%s is already define has Func or hook" % arg_1)
        if '.' not in arg_1:
            arg_1 = arg_0.__module__ + '.' + arg_0.__name__ + '.' + arg_1
        set_one(arg_4, arg_1, arg_5)
        return arg_5
    return wrapper


def Func(arg_0=None):
    """
        Attach a class to a parsing Func and register it to the global
        Func list.
        The class is registered with its name unless directname is provided
    """
    global _Funcs
    arg_1 = _Funcs

    def wrapper(arg_2):
        nonlocal arg_0
        if arg_0 is None:
            arg_0 = arg_2.__name__
        arg_2.ns_name = arg_0
        set_one(arg_1, arg_0, arg_2)

    return wrapper


def Func(arg_0, arg_1: arg_2, arg_3: arg_4) -> bool:
    """Allow to alias a node to another name.

    Useful to Func a node to _ as return of Rule::

        R = [
            __scope__:L [item:I #add_item(L, I]* #Func('_', L)
        ]

    It's also the default behaviour of ':>'

    """

    for arg_5 in arg_0.rule_nodes.maps:
        for arg_6, arg_7 in arg_5.items():
            if arg_6 == arg_1:
                arg_5[arg_6] = arg_3
                return True
    raise Exception('%s not found' % arg_1)


def Func(arg_0) -> bool:
    """Return True if the parser can consume an EOL byte sequence."""
    if arg_0.read_eof():
        return False
    arg_0._stream.save_context()
    arg_0.read_char('\r')
    if arg_0.read_char('\n'):
        return arg_0._stream.validate_context()
    return arg_0._stream.restore_context()


def Func(arg_0) -> bool:
        """Push context variable to store rule nodes."""
        if arg_0.rule_nodes is None:
            arg_0.rule_nodes = collections.ChainMap()
            arg_0.tag_cache = collections.ChainMap()
            arg_0.id_cache = collections.ChainMap()
        else:
            arg_0.rule_nodes = arg_0.rule_nodes.new_child()
            arg_0.tag_cache = arg_0.tag_cache.new_child()
            arg_0.id_cache = arg_0.id_cache.new_child()
        return True


def Func(arg_0) -> bool:
        """Pop context variable that store rule nodes"""
        arg_0.rule_nodes = arg_0.rule_nodes.parents
        arg_0.tag_cache = arg_0.tag_cache.parents
        arg_0.id_cache = arg_0.id_cache.parents
        return True


def Func(arg_0, arg_1: arg_2) -> str:
        """Return the text Func of the node"""
        arg_3 = id(arg_1)
        arg_4 = arg_0.id_cache
        if arg_3 not in arg_4:
            return ""
        arg_5 = arg_4[arg_3]
        arg_6 = arg_0.tag_cache
        if arg_5 not in arg_6:
            raise Exception("Incoherent tag cache")
        arg_7 = arg_6[arg_5]
        arg_8 = "%d:%d" % (arg_7._begin, arg_7._end)
        arg_9 = arg_0._streams[-1].Func_cache
        if arg_8 not in arg_9:
            arg_9[arg_8] = str(arg_7)
        return arg_9[arg_8]


def Func(arg_0, arg_1: arg_2) -> Node:
        """Save the current index under the given name."""
        # Check if we could attach tag cache to current rule_nodes scope
        arg_0.tag_cache[arg_1] = Tag(arg_0._stream, arg_0._stream.index)
        return True


def Func(arg_0, arg_1: arg_2) -> Node:
        """Extract the string between saved and current index."""
        arg_0.tag_cache[arg_1].set_end(arg_0._stream.index)
        return True


def Func(arg_0, arg_1: arg_2) -> bool:
        """
        Merge internal rules set with the given rules
        """
        arg_0._rules = arg_0._rules.new_child()
        for arg_4, arg_5 in arg_1.items():
            if '.' not in arg_4:
                arg_4 = arg_0.__module__ \
                    + '.' + arg_0.__name__ \
                    + '.' + arg_4
            meta.set_one(arg_0._rules, arg_4, arg_5)
        return True


def Func(arg_0, arg_1: arg_2) -> bool:
        """
        Merge internal hooks set with the given hooks
        """
        arg_0._hooks = arg_0._hooks.new_child()
        for arg_4, arg_5 in arg_1.items():
            if '.' not in arg_4:
                arg_4 = arg_0.__module__ \
                    + '.' + arg_0.__name__ \
                    + '.' + arg_4
            meta.set_one(arg_0._hooks, arg_4, arg_5)
        return True


def Func(arg_0, arg_1: arg_2) -> Node:
        """Evaluate a rule by name."""
        # context created by caller
        arg_3 = Node()
        arg_4 = id(arg_3)
        arg_0.rule_nodes['_'] = arg_3
        arg_0.id_cache[arg_4] = '_'
        # TODO: other behavior for  empty rules?
        if arg_1 not in arg_0.__class__._rules:
            arg_0.diagnostic.notify(
                error.Severity.ERROR,
                "Unknown rule : %s" % arg_1,
                error.LocationInfo.from_stream(arg_0._stream, is_error=True)
            )
            raise arg_0.diagnostic
        arg_0._lastRule = arg_1
        arg_8 = arg_0.__class__._rules[arg_1]
        # TODO: add packrat cache here, same rule - same pos == same res
        arg_9 = arg_8(arg_0)
        if arg_9:
            arg_9 = arg_0.rule_nodes['_']
        return arg_9


def Func(arg_0, arg_1: arg_2) -> bool:
        """Same as readText but doesn't consume the stream."""
        arg_3 = arg_0._stream.index
        arg_4 = arg_3 + len(arg_1)
        if arg_4 > arg_0._stream.eos_index:
            return False
        return arg_0._stream[arg_0._stream.index:arg_4] == arg_1


def Func(arg_0, arg_1: arg_2) -> bool:
        """
        Consume the c head byte, increment current index and return True
        else return False. It use peekchar and it's the same as '' in BNF.
        """
        if arg_0.read_eof():
            return False
        arg_0._stream.save_context()
        if arg_1 == arg_0._stream.peek_char:
            arg_0._stream.incpos()
            return arg_0._stream.validate_context()
        return arg_0._stream.restore_context()


def Func(arg_0) -> bool:
        """Consume all the stream. Same as EOF in BNF."""
        if arg_0.read_eof():
            return True
        # TODO: read ALL
        arg_0._stream.save_context()
        while not arg_0.read_eof():
            arg_0._stream.incpos()
        return arg_0._stream.validate_context()


def Func(arg_0) -> bool:
        """Consume whitespace characters."""
        arg_0._stream.save_context()
        if not arg_0.read_eof() and arg_0._stream.peek_char in " \t\v\f\r\n":
            while (not arg_0.read_eof()
                   and arg_0._stream.peek_char in " \t\v\f\r\n"):
                arg_0._stream.incpos()
            return arg_0._stream.validate_context()
        return arg_0._stream.validate_context()


def Func(arg_0, arg_1):
        ''' Set the data type of the hits.

        Fields that are not mentioned here are NOT copied into the clustered hits array.
        Clusterizer has to know the hit data type to produce the clustered hit result with the same data types.

        Parameters:
        -----------
        hit_dtype : numpy.dtype or equivalent
            Defines the dtype of the hit array.

        Example:
        --------
        hit_dtype = [("column", np.uint16), ("row", np.uint16)], where
        "column", "row" is the field name of the input hit array.
        '''

        if not arg_1:
            arg_1 = np.dtype([])
        else:
            arg_1 = np.dtype(arg_1)
        arg_2 = arg_1.descr

        # Add default back to description
        for arg_3, arg_4 in arg_0._default_cluster_hits_descr:
            if arg_0._hit_fields_mapping[arg_3] not in arg_1.fields:
                arg_2.append((arg_3, arg_4))
        arg_0._cluster_hits_descr = arg_2
        arg_0._init_arrays(size=0)