Source code for mimesis.providers.hardware

# -*- coding: utf-8 -*-

"""Provides data related to hardware."""

from mimesis.data import (
    CPU,
    CPU_CODENAMES,
    CPU_MODEL_CODES,
    GENERATION,
    GRAPHICS,
    HDD_SSD,
    MANUFACTURERS,
    PHONE_MODELS,
    RAM_SIZES,
    RAM_TYPES,
    RESOLUTIONS,
    SCREEN_SIZES,
)
from mimesis.providers.base import BaseProvider

__all__ = ["Hardware"]


[docs]class Hardware(BaseProvider): """Class for generate data related to hardware."""
[docs] class Meta: """Class for metadata.""" name = "hardware"
[docs] def resolution(self) -> str: """Get a random screen resolution. :return: Resolution of screen. :Example: 1280x720. """ return self.random.choice(RESOLUTIONS)
[docs] def screen_size(self) -> str: """Get a random size of screen in inch. :return: Screen size. :Example: 13″. """ return self.random.choice(SCREEN_SIZES)
[docs] def cpu(self) -> str: """Get a random CPU name. :return: CPU name. :Example: Intel® Core i7. """ return self.random.choice(CPU)
[docs] def cpu_frequency(self) -> str: """Get a random frequency of CPU. :return: Frequency of CPU. :Example: 4.0 GHz. """ return "{}GHz".format( self.random.uniform( a=1.5, b=4.3, precision=1, ), )
[docs] def generation(self) -> str: """Get a random generation. :return: Generation of something. :Example: 6th Generation. """ return self.random.choice(GENERATION)
[docs] def cpu_model_code(self) -> str: """Get a random CPU model. :return: CPU model. """ return self.random.choice(CPU_MODEL_CODES)
[docs] def cpu_codename(self) -> str: """Get a random CPU code name. :return: CPU code name. :Example: Cannonlake. """ return self.random.choice(CPU_CODENAMES)
[docs] def ram_type(self) -> str: """Get a random RAM type. :return: Type of RAM. :Example: DDR3. """ return self.random.choice(RAM_TYPES)
[docs] def ram_size(self) -> str: """Get a random size of RAM. :return: RAM size. :Example: 16GB. """ return self.random.choice(RAM_SIZES)
[docs] def ssd_or_hdd(self) -> str: """Get a random value from list. :return: HDD or SSD. :Example: 512GB SSD. """ return self.random.choice(HDD_SSD)
[docs] def graphics(self) -> str: """Get a random graphics. :return: Graphics. :Example: Intel® Iris™ Pro Graphics 6200. """ return self.random.choice(GRAPHICS)
[docs] def manufacturer(self) -> str: """Get a random manufacturer. :return: Manufacturer. :Example: Dell. """ return self.random.choice(MANUFACTURERS)
[docs] def phone_model(self) -> str: """Get a random phone model. :return: Phone model. :Example: Nokia Lumia 920. """ return self.random.choice(PHONE_MODELS)