# Path: biggraphite/utils.py
# DEFAULT_LOG_LEVEL = "WARNING"
# DEFAULT_ADMIN_PORT = None
# DEFAULT_GRAPHITE_ROOT = '/opt/graphite'
# class Error(Exception):
# class ConfigError(Error):
# class FileWatcher:
# class FeatureSwitch:
#     def __init__(self, filename):
#     def watch(self):
#     def __init__(self, watcher, default_value):
#     def enabled(self):
#     def watch(self):
# def start_admin(settings):
# def set_log_level(settings):
# def manipulate_paths_like_upstream(_executable, sys_path):
# def setup_graphite_root_path(carbon_util_file):
# def round_down(rounded, divider):
# def round_up(rounded, divider):


import codecs
import datetime
import json
import math
import prometheus_client
import re
import uuid
import weakref
import enum
import six
from biggraphite import utils as bg_utils
        """Return time elapsed since Unix epoch in count of self.duration.

        A "stage epoch" is a range of timestamps: [N*stage_duration, (N+1)*stage_duration[
        This function returns N.

        Args:
          timestamp: A timestamp in seconds.
        """
        return int(timestamp // self.duration)

    @classmethod
    def from_string(cls, s):
        """Parse results of as_string into an instance."""
        match = cls._STR_RE.match(s)
        if not match:
            raise InvalidArgumentError("Invalid retention: '%s'" % s)
        groups = match.groupdict()
        return cls(
            points=int(groups["points"]),
            precision=int(groups["precision"]),
            stage0=bool(groups["type"] == "_0"),
        )

    @property
    def precision_ms(self):
        """The precision of this stage in milliseconds."""
        return self.precision * 1000

    def round_down(self, timestamp):
        """Round down a timestamp to a multiple of the precision."""

# Path: biggraphite/utils.py
# DEFAULT_LOG_LEVEL = "WARNING"
# DEFAULT_ADMIN_PORT = None
# DEFAULT_GRAPHITE_ROOT = '/opt/graphite'
# class Error(Exception):
# class ConfigError(Error):
# class FileWatcher:
# class FeatureSwitch:
#     def __init__(self, filename):
#     def watch(self):
#     def __init__(self, watcher, default_value):
#     def enabled(self):
#     def watch(self):
# def start_admin(settings):
# def set_log_level(settings):
# def manipulate_paths_like_upstream(_executable, sys_path):
# def setup_graphite_root_path(carbon_util_file):
# def round_down(rounded, divider):
# def round_up(rounded, divider):


# Path: biggraphite/metric.py
import codecs
import datetime
import json
import math
import prometheus_client
import re
import uuid
import weakref
import enum
import six
from biggraphite import utils as bg_utils

        """Return time elapsed since Unix epoch in count of self.duration.

        A "stage epoch" is a range of timestamps: [N*stage_duration, (N+1)*stage_duration[
        This function returns N.

        Args:
          timestamp: A timestamp in seconds.
        """
        return int(timestamp // self.duration)

    @classmethod
    def from_string(cls, s):
        """Parse results of as_string into an instance."""
        match = cls._STR_RE.match(s)
        if not match:
            raise InvalidArgumentError("Invalid retention: '%s'" % s)
        groups = match.groupdict()
        return cls(
            points=int(groups["points"]),
            precision=int(groups["precision"]),
            stage0=bool(groups["type"] == "_0"),
        )

    @property
    def precision_ms(self):
        """The precision of this stage in milliseconds."""
        return self.precision * 1000

    def round_down(self, timestamp):
        """Round down a timestamp to a multiple of the precision."""

        return bg_utils.round_down(timestamp, self.precision)