How to use the vininfo.common.Annotatable function in vininfo

To help you get started, we’ve selected a few vininfo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github idlesign / vininfo / vininfo / details / _base.py View on Github external
__slots__ = ['source', 'defs']

    def __init__(self, code_source=None, definitions=None):
        self.source = code_source
        self.defs = definitions or {}

    def __get__(self, instance: 'VinDetails', owner: Type['VinDetails']) -> DetailWrapper:
        """
        :param instance:
        :param owner:

        """
        return DetailWrapper(instance, self)


class VinDetails(Annotatable):
    """Offers advanced (manufacturer specific) VIN data extraction ficilities."""

    annotate_titles = {
        'body': 'Body',
        'engine': 'Engine',
        'model': 'Model',
        'plant': 'Plant',
        'transmission': 'Transmission',
        'serial': 'Serial',
    }

    def __init__(self, vin: 'Vin'):
        self._vin = vin

    body = Detail()
    engine = Detail()
github idlesign / vininfo / vininfo / toolbox.py View on Github external
from datetime import datetime
from itertools import cycle
from typing import Optional, List

from .common import Annotatable, Brand, UnsupportedBrand
from .dicts import COUNTRIES, WMI, REGIONS
from .exceptions import ValidationError

if False:  # pragma: nocover
    from .details._base import VinDetails  # noqa


class Vin(Annotatable):
    """Offers basic VIN data extraction facilities."""

    annotate_titles = {
        'manufacturer': 'Manufacturer',
        'region': 'Region',
        'country': 'Country',
        'years': 'Years',
    }

    def __init__(self, num: str):
        self.num = self.validate(num)

        details_extractor = self.brand.extractor

        if details_extractor:
            details_extractor = details_extractor(self)