Best Python code snippet using robotframework-pageobjects_python
scalarfloat.py
Source:scalarfloat.py
1# coding: utf-82from __future__ import print_function, absolute_import, division, unicode_literals3import sys4from .compat import no_limit_int # NOQA5from ruamel.yaml.anchor import Anchor6if False: # MYPY7 from typing import Text, Any, Dict, List # NOQA8__all__ = ['ScalarFloat', 'ExponentialFloat', 'ExponentialCapsFloat']9class ScalarFloat(float):10 def __new__(cls, *args, **kw):11 # type: (Any, Any, Any) -> Any12 width = kw.pop('width', None) # type: ignore13 prec = kw.pop('prec', None) # type: ignore14 m_sign = kw.pop('m_sign', None) # type: ignore15 m_lead0 = kw.pop('m_lead0', 0) # type: ignore16 exp = kw.pop('exp', None) # type: ignore17 e_width = kw.pop('e_width', None) # type: ignore18 e_sign = kw.pop('e_sign', None) # type: ignore19 underscore = kw.pop('underscore', None) # type: ignore20 anchor = kw.pop('anchor', None) # type: ignore21 v = float.__new__(cls, *args, **kw) # type: ignore22 v._width = width23 v._prec = prec24 v._m_sign = m_sign25 v._m_lead0 = m_lead026 v._exp = exp27 v._e_width = e_width28 v._e_sign = e_sign29 v._underscore = underscore30 if anchor is not None:31 v.yaml_set_anchor(anchor, always_dump=True)32 return v33 def __iadd__(self, a): # type: ignore34 # type: (Any) -> Any35 return float(self) + a36 x = type(self)(self + a)37 x._width = self._width38 x._underscore = self._underscore[:] if self._underscore is not None else None # NOQA39 return x40 def __ifloordiv__(self, a): # type: ignore41 # type: (Any) -> Any42 return float(self) // a43 x = type(self)(self // a)44 x._width = self._width45 x._underscore = self._underscore[:] if self._underscore is not None else None # NOQA46 return x47 def __imul__(self, a): # type: ignore48 # type: (Any) -> Any49 return float(self) * a50 x = type(self)(self * a)51 x._width = self._width52 x._underscore = self._underscore[:] if self._underscore is not None else None # NOQA53 x._prec = self._prec # check for others54 return x55 def __ipow__(self, a): # type: ignore56 # type: (Any) -> Any57 return float(self) ** a58 x = type(self)(self ** a)59 x._width = self._width60 x._underscore = self._underscore[:] if self._underscore is not None else None # NOQA61 return x62 def __isub__(self, a): # type: ignore63 # type: (Any) -> Any64 return float(self) - a65 x = type(self)(self - a)66 x._width = self._width67 x._underscore = self._underscore[:] if self._underscore is not None else None # NOQA68 return x69 @property70 def anchor(self):71 # type: () -> Any72 if not hasattr(self, Anchor.attrib):73 setattr(self, Anchor.attrib, Anchor())74 return getattr(self, Anchor.attrib)75 def yaml_anchor(self, any=False):76 # type: (bool) -> Any77 if not hasattr(self, Anchor.attrib):78 return None79 if any or self.anchor.always_dump:80 return self.anchor81 return None82 def yaml_set_anchor(self, value, always_dump=False):83 # type: (Any, bool) -> None84 self.anchor.value = value85 self.anchor.always_dump = always_dump86 def dump(self, out=sys.stdout):87 # type: (Any) -> Any88 out.write(89 'ScalarFloat({}| w:{}, p:{}, s:{}, lz:{}, _:{}|{}, w:{}, s:{})\n'.format(90 self,91 self._width, # type: ignore92 self._prec, # type: ignore93 self._m_sign, # type: ignore94 self._m_lead0, # type: ignore95 self._underscore, # type: ignore96 self._exp, # type: ignore97 self._e_width, # type: ignore98 self._e_sign, # type: ignore99 )100 )101class ExponentialFloat(ScalarFloat):102 def __new__(cls, value, width=None, underscore=None):103 # type: (Any, Any, Any) -> Any104 return ScalarFloat.__new__(cls, value, width=width, underscore=underscore)105class ExponentialCapsFloat(ScalarFloat):106 def __new__(cls, value, width=None, underscore=None):107 # type: (Any, Any, Any) -> Any...
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 = self._underscore[:] if self._underscore is not None else None # type: ignore # NOQA21 return x22 def __ifloordiv__(self, a): # type: ignore23 # type: (Any) -> Any24 x = type(self)(self // a)25 x._width = self._width # type: ignore26 x._underscore = self._underscore[:] if self._underscore is not None else None # type: ignore # NOQA27 return x28 def __imul__(self, a): # type: ignore29 # type: (Any) -> Any30 x = type(self)(self * a)31 x._width = self._width # type: ignore32 x._underscore = self._underscore[:] if self._underscore is not None else None # type: ignore # NOQA33 return x34 def __ipow__(self, a): # type: ignore35 # type: (Any) -> Any36 x = type(self)(self ** a)37 x._width = self._width # type: ignore38 x._underscore = self._underscore[:] if self._underscore is not None else None # type: ignore # NOQA39 return x40 def __isub__(self, a): # type: ignore41 # type: (Any) -> Any42 x = type(self)(self - a)43 x._width = self._width # type: ignore44 x._underscore = self._underscore[:] if self._underscore is not None else None # type: ignore # NOQA45 return x46class BinaryInt(ScalarInt):47 def __new__(cls, value, width=None, underscore=None):48 # type: (Any, Any, Any) -> Any49 return ScalarInt.__new__(cls, value, width=width, underscore=underscore)50class OctalInt(ScalarInt):51 def __new__(cls, value, width=None, underscore=None):52 # type: (Any, Any, Any) -> Any53 return ScalarInt.__new__(cls, value, width=width, underscore=underscore)54# mixed casing of A-F is not supported, when loading the first non digit55# determines the case56class HexInt(ScalarInt):57 """uses lower case (a-f)"""58 def __new__(cls, value, width=None, underscore=None):59 # type: (Any, Any, Any) -> Any60 return ScalarInt.__new__(cls, value, width=width, underscore=underscore)61class HexCapsInt(ScalarInt):62 """uses upper case (A-F)"""63 def __new__(cls, value, width=None, underscore=None):64 # 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!!