コード例 #1
0
ファイル: xform.py プロジェクト: stpierre/crashes
"""Produce graphs of collision data."""

import calendar
import collections
import datetime
import functools
import json
import operator
import os

from crashes.commands import base
from crashes.commands import curate
from crashes import log

LOG = log.getLogger(__name__)


@functools.total_ordering
class AgeRange(object):
    def __init__(self, min=None, max=None):
        self._min = min or 0
        self._max = max

    def contains(self, other):
        if isinstance(other, AgeRange):
            return self.contains(other._min) and self.contains(other._max)
        return ((self._max is None and other >= self._min) or
                (self._min <= other <= self._max))

    def __str__(self):
        if self._max:
コード例 #2
0
"""Produce graphs of collision data."""

import calendar
import collections
import datetime
import functools
import json
import operator
import os

from crashes.commands import base
from crashes.commands import curate
from crashes import log

LOG = log.getLogger(__name__)


@functools.total_ordering
class AgeRange(object):
    def __init__(self, min=None, max=None):
        self._min = min or 0
        self._max = max

    def contains(self, other):
        if isinstance(other, AgeRange):
            return self.contains(other._min) and self.contains(other._max)
        return ((self._max is None and other >= self._min)
                or (self._min <= other <= self._max))

    def __str__(self):
        if self._max: