Best Python code snippet using molecule_python
scalarint.py
Source:scalarint.py  
1# coding: utf-82from __future__ import print_function, absolute_import, division, unicode_literals3if False:  # MYPY4    from typing import Text, Any, Dict, List  # NOQA5__all__ = ['ScalarInt', 'BinaryInt', 'OctalInt', 'HexInt', 'HexCapsInt']6from .compat import no_limit_int  # NOQA7class ScalarInt(no_limit_int):8    def __new__(cls, *args, **kw):9        # type: (Any, Any, Any) -> Any10        width = kw.pop('width', None)  # type: ignore11        underscore = kw.pop('underscore', None)  # type: ignore12        v = no_limit_int.__new__(cls, *args, **kw)  # type: ignore13        v._width = width14        v._underscore = underscore15        return v16    def __iadd__(self, a):  # type: ignore17        # type: (Any) -> Any18        x = type(self)(self + a)19        x._width = self._width  # type: ignore20        x._underscore = (  # type: ignore21            self._underscore[:] if self._underscore is not None else None  # type: ignore22        )  # NOQA23        return x24    def __ifloordiv__(self, a):  # type: ignore25        # type: (Any) -> Any26        x = type(self)(self // a)27        x._width = self._width  # type: ignore28        x._underscore = (  # type: ignore29            self._underscore[:] if self._underscore is not None else None  # type: ignore30        )  # NOQA31        return x32    def __imul__(self, a):  # type: ignore33        # type: (Any) -> Any34        x = type(self)(self * a)35        x._width = self._width  # type: ignore36        x._underscore = (  # type: ignore37            self._underscore[:] if self._underscore is not None else None  # type: ignore38        )  # NOQA39        return x40    def __ipow__(self, a):  # type: ignore41        # type: (Any) -> Any42        x = type(self)(self ** a)43        x._width = self._width  # type: ignore44        x._underscore = (  # type: ignore45            self._underscore[:] if self._underscore is not None else None  # type: ignore46        )  # NOQA47        return x48    def __isub__(self, a):  # type: ignore49        # type: (Any) -> Any50        x = type(self)(self - a)51        x._width = self._width  # type: ignore52        x._underscore = (  # type: ignore53            self._underscore[:] if self._underscore is not None else None  # type: ignore54        )  # NOQA55        return x56class BinaryInt(ScalarInt):57    def __new__(cls, value, width=None, underscore=None):58        # type: (Any, Any, Any) -> Any59        return ScalarInt.__new__(cls, value, width=width, underscore=underscore)60class OctalInt(ScalarInt):61    def __new__(cls, value, width=None, underscore=None):62        # type: (Any, Any, Any) -> Any63        return ScalarInt.__new__(cls, value, width=width, underscore=underscore)64# mixed casing of A-F is not supported, when loading the first non digit65# determines the case66class HexInt(ScalarInt):67    """uses lower case (a-f)"""68    def __new__(cls, value, width=None, underscore=None):69        # type: (Any, Any, Any) -> Any70        return ScalarInt.__new__(cls, value, width=width, underscore=underscore)71class HexCapsInt(ScalarInt):72    """uses upper case (A-F)"""73    def __new__(cls, value, width=None, underscore=None):74        # type: (Any, Any, Any) -> Any...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
